Search code examples
pythonpython-sphinxread-the-docs

ReadTheDocs Sphinx build failing due to version error


I've created a documentation for python library that I released last December. https://monalysa.readthedocs.io/en/latest/

GitHub Repository: https://github.com/siva82kb/monalysa/tree/main

I've made some changes to the structure of the documentation but the build now fails on ReadTheDocs. Its appears to be an error with the version of Sphinx. I get the following error in the build step.

Running Sphinx v4.5.0
loading translations [en]... done

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/monalysa/envs/latest/lib/python3.9/site-packages/sphinx/registry.py", line 438, in load_extension
    metadata = setup(app)
  File "/home/docs/checkouts/readthedocs.org/user_builds/monalysa/envs/latest/lib/python3.9/site-packages/sphinxcontrib/applehelp/__init__.py", line 230, in setup
    app.require_sphinx('5.0')
  File "/home/docs/checkouts/readthedocs.org/user_builds/monalysa/envs/latest/lib/python3.9/site-packages/sphinx/application.py", line 393, in require_sphinx
    raise VersionRequirementError(version)
sphinx.errors.VersionRequirementError: 5.0

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

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/monalysa/envs/latest/lib/python3.9/site-packages/sphinx/cmd/build.py", line 272, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/home/docs/checkouts/readthedocs.org/user_builds/monalysa/envs/latest/lib/python3.9/site-packages/sphinx/application.py", line 219, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/monalysa/envs/latest/lib/python3.9/site-packages/sphinx/application.py", line 380, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/monalysa/envs/latest/lib/python3.9/site-packages/sphinx/registry.py", line 441, in load_extension
    raise VersionRequirementError(
sphinx.errors.VersionRequirementError: The sphinxcontrib.applehelp extension used by this project needs at least Sphinx v5.0; it therefore cannot be built with this version.

Sphinx version error:
The sphinxcontrib.applehelp extension used by this project needs at least Sphinx v5.0; it therefore cannot be built with this version.

I have tried to force the version of Sphinx to 5.0.2 and the version of phinxcontrib.applehelp to be 1.0.7, which was the version that successfully worked in the previous version of the documentation.

No matter what versions I put down in the requirements.txt file, I get the same error.

What have done wrong? How do I fix this issue?


Solution

  • You have sphinx==5.0.2 in the root requirements.txt file.

    It should be moved to docs/requirements.txt.

    While you are at it, sphinxcontrib.applehelp==1.0.7 should also be removed from the root requirements.txt.