Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sphinx error: master file [..]/checkouts/latest/contents.rst not found #2569

Closed
gr2m opened this issue Dec 31, 2016 · 15 comments
Closed

Sphinx error: master file [..]/checkouts/latest/contents.rst not found #2569

gr2m opened this issue Dec 31, 2016 · 15 comments

Comments

@gr2m
Copy link
Contributor

gr2m commented Dec 31, 2016

I’m still new to readthedocs.org and have no experience with either Python nor Sphinx, please excuse me if I’m doing something obviously wrong. I googled the error and have found other builds failing with the same error, but when I looked at their commits that lead to a successful build, the changes didn’t make sense to me.

Details

Expected Result

I expected a new version of docs to be built at http://hoodie-test.readthedocs.io/en/latest/

Actual Result

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/envs/latest/local/lib/python2.7/site-packages/sphinx/cmdline.py", line 244, in main
    app.build(opts.force_all, filenames)
  File "/home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/envs/latest/local/lib/python2.7/site-packages/sphinx/application.py", line 266, in build
    self.builder.build_update()
  File "/home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 251, in build_update
    'out of date' % len(to_build))
  File "/home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/envs/latest/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 265, in build
    self.doctreedir, self.app))
  File "/home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/envs/latest/local/lib/python2.7/site-packages/sphinx/environment.py", line 622, in update
    self.doc2path(config.master_doc))
SphinxError: master file /home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/checkouts/latest/contents.rst not found

Sphinx error:
master file /home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/checkouts/latest/contents.rst not found
@gr2m gr2m changed the title Sphinx error: master file /home/docs/checkouts/readthedocs.org/user_builds/hoodie-test/checkouts/latest/contents.rst not found Sphinx error: master file [..]/checkouts/latest/contents.rst not found Dec 31, 2016
gr2m added a commit to gr2m/hoodie-readthedocs-test that referenced this issue Dec 31, 2016
@agjohnson
Copy link
Contributor

This doesn't look to be a problem with RTD, so I'm going to close it. The error message states it is looking for a contents.rst, which doesn't exist. If you don't specify otherwise, Sphinx's default master_doc setting is contents. If you'd like to use index instead, you'll need to create a configuration file. I suggest you first explore http://www.sphinx-doc.org/en/1.5.1/tutorial.html as you should be getting the same errors locally, it might be easier to learn Sphinx this way.

@XinArkh
Copy link

XinArkh commented Apr 20, 2019

Encountered the same problem here.

I'm using sphinx 2.0.1. The generated structure by sphinx-quickstart command is built into html documentation successfully in my environment, while in readthedocs.org there occurs "contents.rst not found" error.

I finally found it works by adding the following line in conf.py to explicitly assign the master document:

master_doc = 'index'

I guess this issue is caused by the conflicts of the default sphinx version in readthedocs and the local environment.

I just record this solution here in case someone like me will be confused by this issue and have no idea about how to deal with it.

@stsewd
Copy link
Member

stsewd commented Apr 22, 2019

You can use a requirements.txt file to use the same version of sphinx you use locally https://docs.readthedocs.io/en/stable/guides/specifying-dependencies.html

willprice added a commit to willprice/flowty that referenced this issue Apr 28, 2019
I get the errror:
```

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/flowty/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 304, in build_main
    app.build(args.force_all, filenames)
  File "/home/docs/checkouts/readthedocs.org/user_builds/flowty/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 341, in build
    self.builder.build_update()
  File "/home/docs/checkouts/readthedocs.org/user_builds/flowty/envs/latest/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 347, in build_update
    len(to_build))
  File "/home/docs/checkouts/readthedocs.org/user_builds/flowty/envs/latest/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 360, in build
    updated_docnames = set(self.read())
  File "/home/docs/checkouts/readthedocs.org/user_builds/flowty/envs/latest/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 472, in read
    self.env.doc2path(self.config.master_doc))
sphinx.errors.SphinxError: master file /home/docs/checkouts/readthedocs.org/user_builds/flowty/checkouts/latest/docs/source/contents.rst not found

Sphinx error:
master file /home/docs/checkouts/readthedocs.org/user_builds/flowty/checkouts/latest/docs/source/contents.rst not found
```

See readthedocs/readthedocs.org#2569
davmlaw added a commit to SACGF/variantgrid_docs that referenced this issue May 7, 2019
@rahulgorai22
Copy link

Encountered the same problem here.

I'm using sphinx 2.0.1. The generated structure by sphinx-quickstart command is built into html documentation successfully in my environment, while in readthedocs.org there occurs "contents.rst not found" error.

I finally found it works by adding the following line in conf.py to explicitly assign the master document:

master_doc = 'index'

I guess this issue is caused by the conflicts of the default sphinx version in readthedocs and the local environment.

I just record this solution here in case someone like me will be confused by this issue and have no idea about how to deal with it.

Worked for me !! Thanks

@didicodes
Copy link

master_doc = 'index'

I have been struggling with this issue for hours. thank you for sharing the answer.

@espdev
Copy link
Contributor

espdev commented Sep 12, 2019

You can use a requirements.txt file to use the same version of sphinx you use locally https://docs.readthedocs.io/en/stable/guides/specifying-dependencies.html

Currently, RTD installs the following packages before installing packages from the project requirements file:

python -m pip install --upgrade --cache-dir .cache/pip Pygments==2.3.1 setuptools==41.0.1 docutils==0.14 mock==1.0.1 pillow==5.4.1 alabaster>=0.7,<0.8,!=0.7.5 commonmark==0.8.1 recommonmark==0.5.0 sphinx<2 sphinx-rtd-theme<0.5 readthedocs-sphinx-ext<1.1 

I do not know why they use such old versions (sphinx<2 for example). If I do not set versions in my requirement file, sphinx version will not be updated and I will get the error contents.rst not found. In my opinion, it seems stupid.

oconnor663 added a commit to oconnor663/duct.py that referenced this issue Sep 19, 2019
alahiff added a commit to prominence-eosc/docs-eosc that referenced this issue Sep 27, 2019
teddygroves added a commit to biosustain/Maud that referenced this issue Oct 30, 2019
dzerrenner pushed a commit to pypyr-scheduler/pypyr-scheduler-server that referenced this issue Nov 15, 2019
alorence added a commit to alorence/django-modern-rpc that referenced this issue Dec 5, 2019
khallock pushed a commit to NCAR/geocat-examples that referenced this issue Dec 10, 2019
Baschdl added a commit to match4everyone/match4everything that referenced this issue Jul 10, 2020
alexdutton added a commit to swordapp/sword3-client.py that referenced this issue Jul 16, 2020
This fixes a build error, wherein rtd was looking for contents.rst.

More detail, and the fix, at readthedocs/readthedocs.org#2569
hrsano645 added a commit to py-suruga/pycon-jp-2020-tutorial that referenced this issue Aug 13, 2020
argosopentech added a commit to argosopentech/argos-translate that referenced this issue Sep 13, 2020
ybnd added a commit to ybnd/shapeflow that referenced this issue Sep 18, 2020
abhilash1in added a commit to abhilash1in/paperplane that referenced this issue Sep 21, 2020
psykidellic added a commit to psykidellic/python-lfu that referenced this issue Oct 17, 2020
readthedocs.org expects contents.rst which is different from what we get
locally.

readthedocs/readthedocs.org#2569
colinangusmackay added a commit to Stravaig-Projects/Stravaig.Extensions.Configuration.Diagnostics that referenced this issue Jan 5, 2021
readthedocs/readthedocs.org#2569 says it should also fail locally if it fails on RTD, but it works locally. However, orther commenters suggest adding master_doc = 'index' to the conf.py file.
colinangusmackay added a commit to Stravaig-Projects/Stravaig.Extensions.Configuration.Diagnostics that referenced this issue Jan 17, 2021
readthedocs/readthedocs.org#2569 says it should also fail locally if it fails on RTD, but it works locally. However, orther commenters suggest adding master_doc = 'index' to the conf.py file.
colinangusmackay added a commit to Stravaig-Projects/Stravaig.Extensions.Configuration.Diagnostics that referenced this issue Jan 23, 2021
readthedocs/readthedocs.org#2569 says it should also fail locally if it fails on RTD, but it works locally. However, orther commenters suggest adding master_doc = 'index' to the conf.py file.
@benjaoming
Copy link
Contributor

The confusion is well-stated by @adamj-codethink:

I am also seeing this issue after follow the "getting started with sphinx" guide: https://docs.readthedocs.io/en/stable/intro/getting-started-with-sphinx.html, it seems like a bug with these instructions?

The instructions are fine. The sphinx-quickstart for the latest versions 3.x of Sphinx will create a conf.py without any mentioning of master_doc, thus the default value index is used. It will work fine locally with Sphinx 3.x.

But Read the Docs uses Sphinx 1.8.5 by default and since master_doc isn't specified, another default is used.

Having just onboarded a new user to Read the Docs, this problem came up again: Following standard documentation will land a broken Read the Docs project. Judging from the activity in this thread, it's a problem to many people. For instance the above comment:

I have been struggling with this issue for hours. thank you for sharing the answer.

Solutions?

User has to fix it: Either the user has to add master_doc in their configuration or configure the Read the Docs project to use a newer version of Sphinx. I don't think this is a good way forward for a documentation project 😄

Read the Docs fixing it: We can expect that people are now following guides with the latest version of Sphinx installed locally.

  • New projects should be built with Sphinx 3.x as the default
  • Read the Docs should force a default master_doc="index" if unset in the supplied docs/conf.py.

Any further thoughts on this?

@humitos
Copy link
Member

humitos commented Feb 24, 2021

Read the Docs fixing it: We can expect that people are now following guides with the latest version of Sphinx installed locally.

* New projects should be built with Sphinx 3.x as the default

We are already onboard with this solution. @stsewd already created a PR with the new proposed policy for these external dependencies that Read the Docs relies on, and mentioned that RTD should always install the latest Sphinx version: https://github.com/readthedocs/readthedocs.org/pull/7859/files#diff-1d854732c488780cf89b325277dd80220a7e541647ccf1c18bdc372eb7b1a4d6R71

@stsewd
Copy link
Member

stsewd commented Feb 24, 2021

btw, we already install the latest sphinx version for new projects (created after Oct 20, 2020)

@benjaoming
Copy link
Contributor

It sounds great that the latest stable version of Sphinx will always be supported and is used for newer projects, that would fix this issue once and for all.

Can the Sphinx version pinned in requirements/pip.txt be clarified?

# For intersphinx during builds
# Use <2.x until we fix some issues in our theme.
# Some things are not rendering properly and sidebar shows titles in gray.
Sphinx==1.8.5 # pyup: <2.0.0

@stsewd
Copy link
Member

stsewd commented Mar 1, 2021

@benjaminp that dependency is for our intersphinx integration

def _create_intersphinx_data(version, commit, build):
, those dependencies aren't used in the build process. We already fixed the issues with the theme, so we can update sphinx there.

@benjaoming
Copy link
Contributor

Thank you @stsewd - I understand now that this is controlled by the Feature flag USE_SPHINX_LATEST and that new projects need to have this Feature flag enabled. I see that this is the new default for readthedocs.org 👍

USE_SPHINX_LATEST = 'use_sphinx_latest'

I think self-hosted deployments have to define the feature flag default themselves in order to avoid this issue?

@stsewd
Copy link
Member

stsewd commented Mar 18, 2021

I think self-hosted deployments have to define the feature flag default themselves in order to avoid this issue?

Yeah, that's correct. You can set the default_true and future_default_true atributes to True so it's aplied to all projects, old and future ones.

byorgey added a commit to disco-lang/disco that referenced this issue Jan 4, 2022
fdxmw added a commit to UCSBarchlab/PyRTL that referenced this issue Mar 27, 2023
sphinx.errors.SphinxError: master file /home/docs/checkouts/readthedocs.org/user_builds/pyrtl/checkouts/latest/docs/contents.rst not found

See readthedocs/readthedocs.org#2569
@oakdemirci
Copy link

master_doc

master_doc = 'source/index'
this worked for me. Thanks for the redirection =)

adacore-bot pushed a commit to AdaCore/cuda that referenced this issue Nov 16, 2023
Before this patch, the configuration file for the Sphinx
documentation had a workaround for an issue that's no longer present
with the version of Sphinx that comes with anod. This patch removes
that workaround.

The fact that the issue has been fixed upstream can be checked by
browsing the following GitHub issue:

readthedocs/readthedocs.org#2569
bezborodow added a commit to bezborodow/iso6346py that referenced this issue Feb 19, 2024
Sphinx error: root file /home/docs/checkouts/readthedocs.org/user_builds/iso6346-containers/checkouts/latest/docs/source/index.rst not found

https://stackoverflow.com/questions/56336234/build-fail-sphinx-error-contents-rst-not-found

readthedocs/readthedocs.org#2569
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests