Skip to content

Docs build failing on Python 3.13 #1755

@VeckoTheGecko

Description

@VeckoTheGecko
Error log:

Running Sphinx v5.3.0

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/site-packages/sphinx/registry.py", line 459, in load_extension
    mod = import_module(extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/site-packages/sphinx/builders/epub3.py", line 12, in <module>
    from sphinx.builders import _epub_base
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/site-packages/sphinx/builders/_epub_base.py", line 16, in <module>
    from sphinx.builders.html import BuildInfo, StandaloneHTMLBuilder
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/site-packages/sphinx/builders/html/__init__.py", line 46, in <module>
    from sphinx.writers.html import HTMLTranslator, HTMLWriter
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/site-packages/sphinx/writers/html.py", line 21, in <module>
    from sphinx.util.images import get_image_size
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/site-packages/sphinx/util/images.py", line 4, in <module>
    import imghdr
ModuleNotFoundError: No module named 'imghdr'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/site-packages/sphinx/cmd/build.py", line 276, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
                 args.doctreedir, args.builder, args.confoverrides, args.status,
                 args.warning, args.freshenv, args.warningiserror,
                 args.tags, args.verbosity, args.jobs, args.keep_going,
                 args.pdb)
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/site-packages/sphinx/application.py", line 219, in __init__
    self.setup_extension(extension)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/site-packages/sphinx/application.py", line 398, in setup_extension
    self.registry.load_extension(self, extname)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/parcels/conda/1749/lib/python3.13/site-packages/sphinx/registry.py", line 462, in load_extension
    raise ExtensionError(__('Could not import extension %s') % extname,
                         err) from err
sphinx.errors.ExtensionError: Could not import extension sphinx.builders.epub3 (exception: No module named 'imghdr')

Extension error:
Could not import extension sphinx.builders.epub3 (exception: No module named 'imghdr')

Insightful:

The imghdr module is deprecated in Python 3.11 by PEP 594 and is slated for removal in Python 3.13. Source

Solution

Currently we have sphinx<6 in the environment file. We should look at removing this upper bound (making sure it doesn't break any docs), which will give us Python 3.13 support. There was a reason for that upperbound, which I can't recall (nor whether it is still a relevant reason)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions