You’ve just stepped on another Python rake — this time courtesy of Python 3.13, which broke your build not because your code is wrong, but because imghdr was removed from the standard library.
The error:
ModuleNotFoundError: No module named 'imghdr'
comes from Sphinx trying to load the epub3 builder. Sphinx expects imghdr, which was removed in Python 3.13. The Jupyter Book stack (which still depends on Sphinx 5.x/6.x) is not ready for this yet.
This is non-negotiable right now. The whole jupyter-book + sphinx ecosystem breaks on Python 3.13.
Here’s what to do:
deactivate
rm -rf myenv
pyenv or Homebrew to install Python 3.11 if you don’t already have it:brew install pyenv
pyenv install 3.11.8
pyenv local 3.11.8
Or, if using Homebrew directly:
brew install python@3.11
python3.11 -m venv myenv
source myenv/bin/activate
pip install -r requirements.txt
cd list/kitabo/ensi
./python/deploy.py
imghdr was removed in Python 3.13 (PEP 594).epub, so you get punished for code you don’t even use.This is peak Python ecosystem fragility — no layer separation, no fault tolerance.
If downgrading is a hassle, you can monkeypatch your _config.yml to exclude EPUB3:
sphinx:
config:
epub_show_urls: 'footnote'
builder: html
But this won’t fix it unless Jupyter Book itself stops loading the epub3 builder by default — which it doesn’t yet.
Downgrade to Python 3.11 or 3.10. Lock it in your .tool-versions, pyproject.toml, or README. Don’t touch Python 3.13 until Jupyter Book and Sphinx say they’re ready — they’re not.