restructuredtextread-the-docsnbsphinx

Read the Docs with nbsphinx


I created my own docs for Read the Docs. See my repository Some of my docs files are jupyter notebook so I used nbshpinx for it.

In my computer I installed all the dependencies and it works great when I use make html. However, Read the docs throws the error:

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

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 472, in load_extension
    mod = __import__(extname, None, None, ['setup'])
ModuleNotFoundError: No module named 'nbsphinx'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 303, in build_main
    args.tags, args.verbosity, args.jobs, args.keep_going)
  File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 228, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 449, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/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 nbsphinx (exception: No module named 'nbsphinx')

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

Following this tutorial I created two yml files and the error changed to:

Error
Problem in your project's configuration. Invalid "conda.environment": environment not found

Solution

  • Solved it! I followed this tutorial

    I added in readthedocs.yml:

    python:
      version: 3
      install:
        - requirements: docs/requirements.txt
      system_packages: true
    

    And then in docs/requirements.txt:

    ipykernel
    nbsphinx
    

    If questions you can always check the repository where I do it.