Search code examples
pythonpython-sphinxread-the-docs

Read the docs build module not found error, but no local issue


I am trying to use the sphinx-click module in my rst file for my documentation on Read the Docs. It normally auto-builds from the git repo without any issues but now that I want to use sphinx-click I run into issues:

Running Sphinx v5.3.0

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/pycrispr/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 459, in load_extension
    mod = import_module(extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/pycrispr/envs/latest/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sphinx_click'

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

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/pycrispr/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 280, in build_main
    args.pdb)
  File "/home/docs/checkouts/readthedocs.org/user_builds/pycrispr/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 223, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/pycrispr/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 398, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/pycrispr/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 463, in load_extension
    err) from err
sphinx.errors.ExtensionError: Could not import extension sphinx_click (exception: No module named 'sphinx_click')

Extension error:
Could not import extension sphinx_click (exception: No module named 'sphinx_click')

My conf.py includes the following line:

extensions = ['sphinx_click']

And my setup.py includes sphinx-click:

install_requires=['numpy','pandas','pyyaml','Click','sphinx-click'
                      ]

When I build the docs locally, it runs without any errors (although with one warning):

Running Sphinx v5.3.0
WARNING: html_static_path entry '_static' does not exist
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] execution/userguide                                                                                                      
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                                     
generating indices... genindex done
writing additional pages... search done
copying images... [100%] execution/report.png                                                                                                      
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 1 warning.

The HTML pages are in temp.

How can I tell the remote server to install the sphinx-click module?


Solution

  • I solved this issue by changing the Read the Docs Admin > Advanced Settings enter image description here

    Inspired by this answer.