2

I have been trying to build docs on readthedocs for my debut python package QutiePy. Building the docs works fine locally, but when I try to build on readthedocs, autodoc fails to populate my sections and gives the following warning:

WARNING: autodoc: failed to import class 'main.register' from module 'QutiePy'; the following exception was raised:
No module named 'QutiePy'
WARNING: autodoc: failed to import module 'gates' from module 'QutiePy'; the following exception was raised:
No module named 'QutiePy'

I have tried many configurations of conf.py to try and add my package to PATH etc. but nothing I've tried has worked.

You can view the github repo I am using here, I am using the development branch.

Thanks in advance.

UPDATE: I have posted the RTD log here

UPDATE 2: I have posted the NEW RTD log here

  • I have since updated the package name to be all lowercase, this didnt change anything! – franklinscudder Jan 24 '21 at 23:03
  • 1
    One should RTD about [RTD](https://docs.readthedocs.io/en/stable/intro/import-guide.html#building-your-documentation) before using RTD. Specifically you need to configure RTD to install your package and any of its dependencies before its docs can be built. – Steve Piercy Jan 25 '21 at 02:49
  • 1
    I have done this, setting it to install in the admin menu and including a requirements.txt with my dependencies. – franklinscudder Jan 25 '21 at 12:33
  • Check the RTD build log. Does RTD install both your project and its dependencies? – Steve Piercy Jan 25 '21 at 17:56
  • It reads the requirements file and says that the dependencies are already installed (numpy, scipy). I can't find any reference to my package being installed in the log, which I have now posted in the question above. – franklinscudder Jan 25 '21 at 22:37
  • That means you need to include your own package in your RTD requirements file. An RTD requirements file is not your own package's requirements file. – Steve Piercy Jan 26 '21 at 11:49
  • It turned out the package configuration was not correct, so I corrected that and added it to the requirements.txt. It now imports the module fine and gives no warnings in the log but the docs still arenn't populated. I think it may be an autodoc or napoleon problem as I am using both of these? I have followed the steps in the documentation to enable both and again, it all works locally. I have posted the new log in the question. – franklinscudder Jan 26 '21 at 22:25
  • I got it working, thanks so much for your help @StevePiercy! – franklinscudder Jan 26 '21 at 23:46

1 Answers1

1

The solution here was to check that my package was importable from PyPI, adding it to my requirements.txt and making sure that 'Install Project' was selected in the RTD advanced settings. I also added sphinxcontrib-napoleon to requirements.txt and imported it in conf.py although I am unsure if this plays a role at all.

  • 2
    I'm having the same problem, but I want to make sure that docs build for a new version _before_ I release that version. If it has to install my code from PyPI, that doesn't work. – rspeer Apr 01 '21 at 22:24
  • A dirty solution might be to just release a dev version to pypi and test the docs with that. The RTD build container is pretty opaque and undocumented as far as I can tell. I couldn't figure out a way for it to install my package from a local source. – franklinscudder Apr 03 '21 at 01:18
  • 'Install Project' resolved my issue. Thanks! – meliksahturker Apr 21 '22 at 14:39