readthedocs / readthedocs-sphinx-search

Deprecated: Enable search-as-you-type feature for docs hosted by RTD.
https://readthedocs-sphinx-search.readthedocs.io/
MIT License
33 stars 16 forks source link

ModuleNotFoundError: No module named 'sphinx_search' #143

Closed tlongers closed 1 year ago

tlongers commented 1 year ago

Thanks for this great looking enhancement to docs search. I've followed the install docs. This is very possibly a rookie error, but what am I doing wrong here when rebuilding our docs on ReadTheDocs?

conf.py:

extensions = [
    'sphinx.ext.autosectionlabel',
    'sphinx_search.extension',
]

Build command:

python -m sphinx -T -E -b html -d _build/doctrees -D language=en . $READTHEDOCS_OUTPUT/html

Error:

Running Sphinx v1.8.6
loading translations [en]... done

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/research-handbook-security-force-monitor/envs/latest/lib/python3.11/site-packages/sphinx/registry.py", line 472, in load_extension
    mod = __import__(extname, None, None, ['setup'])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'sphinx_search'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/research-handbook-security-force-monitor/envs/latest/lib/python3.11/site-packages/sphinx/cmd/build.py", line 300, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/research-handbook-security-force-monitor/envs/latest/lib/python3.11/site-packages/sphinx/application.py", line 228, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/research-handbook-security-force-monitor/envs/latest/lib/python3.11/site-packages/sphinx/application.py", line 449, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/research-handbook-security-force-monitor/envs/latest/lib/python3.11/site-packages/sphinx/registry.py", line 475, in load_extension
    raise ExtensionError(__('Could not import extension %s') % extname, err)
sphinx.errors.ExtensionError: Could not import extension sphinx_search.extension (exception: No module named 'sphinx_search')

Extension error:
Could not import extension sphinx_search.extension (exception: No module named 'sphinx_search')
stsewd commented 1 year ago

You need to specify the dependency in your RTD configuration file, see https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html#use-a-requirements-file-for-python-dependencies.