1

I am trying to link my Sphinx documentation with Readthedocs. I can build the documentation locally in my computer but when I try to have Readthedocs automatically generate the documentation I get the following error:

Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/helstrom-quantum-centroid-classifier/envs/latest/lib/python3.7/site-packages/sphinx/config.py", line 368, in eval_config_file
    execfile_(filename, namespace)
  File "/home/docs/checkouts/readthedocs.org/user_builds/helstrom-quantum-centroid-classifier/envs/latest/lib/python3.7/site-packages/sphinx/util/pycompat.py", line 150, in execfile_
    exec_(code, _globals)
  File "/home/docs/checkouts/readthedocs.org/user_builds/helstrom-quantum-centroid-classifier/checkouts/latest/docs/conf.py", line 16, in <module>
    import sphinx_gallery
ModuleNotFoundError: No module named 'sphinx_gallery'

I have imported sphinx_gallery in my conf.py file as well as added the extension 'sphinx_gallery.gen_gallery'. My conf.py file is located here: https://github.com/leockl/helstrom-quantum-centroid-classifier/blob/master/docs/conf.py

And my Github project is located here: https://github.com/leockl/helstrom-quantum-centroid-classifier

Where have I gone wrong?

mzjn
  • 48,958
  • 13
  • 128
  • 248
Leockl
  • 1,906
  • 5
  • 18
  • 51
  • 1
    Does this answer your question? [readthedocs not creating documentation from public github repository](https://stackoverflow.com/questions/43217198/readthedocs-not-creating-documentation-from-public-github-repository) – Steve Piercy Jan 21 '20 at 09:27
  • Hi @StevePiercy, thanks. I think I am one step closer now. From this [link](https://docs.readthedocs.io/en/latest/faq.html#my-project-isn-t-building-with-autodoc), the first paragraph says I need to "enable the virtualenv feature in the Admin page of your project". I can't seem to find this option in my Readthedocs project (https://readthedocs.org/dashboard/helstrom-quantum-centroid-classifier/edit/). Do you know where in the Admin page I can enable the virtualenv feature? – Leockl Jan 21 '20 at 12:14
  • I found the option to enable the virtualenv. But I now I am getting another error about `cannot import name 'PackageFinder' from 'pip._internal.index'` (though this is still an ImportError. Based on this [link](https://docs.readthedocs.io/en/latest/faq.html#my-project-isn-t-building-with-autodoc), shouldn't enabling virtualenv resolve all ImportError issues? – Leockl Jan 21 '20 at 13:16
  • Did you read my [answer](https://stackoverflow.com/a/43219151/2214933) to the previously linked question? – Steve Piercy Jan 21 '20 at 13:18
  • Thanks, yeah I did and as a result I have enabled the virtualenv based on the FAQ part in the link. Can I ask what is Pyramid and if that applies to my situation? – Leockl Jan 21 '20 at 13:39
  • Do you also know what is this error `ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/home/docs/checkouts/readthedocs.org/user_builds/helstrom-quantum-centroid-classifier/envs/latest/lib/python3.7/site-packages/pip/_internal/index/__init__.py)` telling me in my Readthedocs [build](https://readthedocs.org/projects/helstrom-quantum-centroid-classifier/builds/10298341/). Perhaps this will point me to a direction. Many thanks – Leockl Jan 21 '20 at 14:17
  • Pyramid here serves as an example of how to set up your repo to build on RTD. In whatever file you declare your requirements, you need to include required packages. – Steve Piercy Jan 21 '20 at 14:37
  • Thanks @StevePiercy. I have tried what was suggested in this [link](https://stackoverflow.com/questions/43217198/readthedocs-not-creating-documentation-from-public-github-repository/43219151#43219151) but I am still having the same error. Because the error `ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/home/docs/checkouts/readthedocs.org/user_builds/helstrom-quantum-centroid-classifier/envs/latest/lib/python3.7/site-packages/pip/_internal/index/__init__.py)` mentions the file `__init__.py', could it be something to do with an error in this file? – Leockl Jan 22 '20 at 10:28
  • 1
    it turns out there was a bug in pip that was fixed. Here's a link to the solution: https://stackoverflow.com/a/59850271/2214933 – Steve Piercy Jan 22 '20 at 23:40
  • Hi @StevePiercy, thanks for keeping an eye out and getting back. Yes, I can confirm the solution worked and I can now create docs in Readthedocs. Many thanks again! – Leockl Jan 23 '20 at 08:45
  • Does this answer your question? [Read-the-docs build fails with "cannot import name 'PackageFinder' from 'pip.\_internal.index'"](https://stackoverflow.com/questions/59846065/read-the-docs-build-fails-with-cannot-import-name-packagefinder-from-pip-in) – fab Feb 19 '20 at 19:59

0 Answers0