Search code examples
pythonpython-sphinxread-the-docs

Readthedocs builds with outdated version of code


When running autodoc in Read-The-Docs, it fails with this error for my project:

Compiling sources ...error: [Errno 2] No such file or directory: 'gfortran'

I have learned that gfortran is not available in RTDF, so I wanted to try avoiding the command that causes the error when running Sphinx - something like

if not 'sphinx' in sys.modules

as suggested in this question.

However, when I want to build the documentation on RTFD, the error still occurs. I have even commented the whole line containing the command without success. Obviously, RTFD does not use the current code in repository branch that it should build from as it still throws an error from a command that is not in the code anymore. I also tried wiping the version, but it didn't help.

I really don't know what's going on. The RTFD build commands are

python3.5 -mvirtualenv --system-site-packages --no-download /home/docs/checkouts/readthedocs.org/user_builds/smuthi/envs/doc

python /home/docs/checkouts/readthedocs.org/user_builds/smuthi/envs/doc/bin/pip install --use-wheel --upgrade --cache-dir /home/docs/checkouts/readthedocs.org/user_builds/smuthi/.cache/pip -I Pygments==2.2.0 setuptools==37.0.0 docutils==0.13.1 mock==1.0.1 pillow==2.6.1 alabaster>=0.7,<0.8,!=0.7.5 commonmark==0.5.4 recommonmark==0.4.0 sphinx==1.6.5 sphinx-rtd-theme<0.3 readthedocs-sphinx-ext<0.6

install --exists-action=w --cache-dir /home/docs/checkouts/readthedocs.org/user_builds/smuthi/.cache/pip -rdocs/requirements.txt

I don't know what this means, but it contains --use-wheel and cache and stuff. An earlier version of my code did have a built distribution on PyPi, but the current doesn't.

Can this be the reason, i.e. does RTFD install from PyPi instead of from the GitLab repository, and does it use old wheels?

Has anybody experienced something similar? Does anybody have an idea what is going wrong?


Solution

  • The problem was that I had the package itself in the docs/requirements.txt file, such that when building, the package was indeed installed from PyPi. After removing it from the requirements, the documentation was built correctly.