You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation.yaml GitHub workflow highlighted this bug as it uses Python v3.13+.
I reproduced the bug locally after upgrading Python to version 3.13 and attempting to build the documentation.
Therefore, this is not a CI/CD bug.
β‘οΈ The cause is the outdated package(s) using the Γ¬mghdr` module that no longer exists as of Python 3.13+.
cd nighscout.github.io
pyenv install 3.13.2
pyenv local 3.13.2
python -m venv venv
pip install -r requirements.txt
rm -rf _build
sphinx-build -M dirhtml docs/ _build/
#=> Running Sphinx v5.3.0
#=>
#=> Extension error:
#=> Could not import extension sphinx.builders.epub3 (exception: No module named 'imghdr')
Solution
A quick search led me to conclude that sphinx version 5.3 is the only package that uses it.
grep -r imghdr venv/lib/python3.13/site-packages/
Binary file venv/lib/python3.13/site-packages//sphinx/util/__pycache__/images.cpython-313.pyc matches
venv/lib/python3.13/site-packages//sphinx/util/images.py:import imghdr
venv/lib/python3.13/site-packages//sphinx/util/images.py: imgtype = imghdr.what(stream)
venv/lib/python3.13/site-packages//sphinx/util/images.py: """An additional imghdr library helper; test the header is SVG's or not."""
venv/lib/python3.13/site-packages//sphinx/util/images.py:# install test_svg() to imghdr
venv/lib/python3.13/site-packages//sphinx/util/images.py:# refs: https://docs.python.org/3.6/library/imghdr.html#imghdr.tests
venv/lib/python3.13/site-packages//sphinx/util/images.py:imghdr.tests.append(test_svg)
π― So, I suggest updating the project packages/dependencies:
The text was updated successfully, but these errors were encountered:
ebouchut
changed the title
GitHub Workflow Error: No module named 'imghdr'
π GitHub Workflow Error: No module named 'imghdr'Feb 20, 2025
ebouchut
changed the title
π GitHub Workflow Error: No module named 'imghdr'
π Error when building documentation with Python 3.13+ (No module named 'imghdr')
Feb 20, 2025
Description
β Since Feb 17, the
documentation.yaml
workflow has been failing repeatedly with this error:Could not import extension sphinx.builders.epub3 (exception: No module named 'imghdr'
Cause
The
imghdr
module has been removed from the Python Standard Library as of Python 3.13, following its deprecation in Python 3.11.The
documentation.yaml
GitHub workflow highlighted this bug as it uses Python v3.13+.I reproduced the bug locally after upgrading Python to version 3.13 and attempting to build the documentation.
Therefore, this is not a CI/CD bug.
β‘οΈ The cause is the outdated package(s) using the Γ¬mghdr` module that no longer exists as of Python 3.13+.
Solution
A quick search led me to conclude that
sphinx
version 5.3 is the only package that uses it.π― So, I suggest updating the project packages/dependencies:
imghdr
, i.e.sphinx
The text was updated successfully, but these errors were encountered: