readthedocs.org: Build Failed. TypeError: 'generator' object is not subscriptable
Update from @astrojuanlu: see this comment for a workaround for this issue, our blog for a more detailed explanation, and this comment for current status of this issue
Success Build: https://readthedocs.org/projects/diadocsdk-1c/builds/15092197/ Failed Build: https://readthedocs.org/projects/diadocsdk-1c/builds/15095749/
It’s the same commit
What is changed during 8 hours ? What can I do for successful build?
building [html]: targets for 402 source files that are out of date
updating environment: 402 added, 0 changed, 0 removed
reading sources... [ 0%] ComObjects/AcceptanceCertificateBuyerContent
reading sources... [ 0%] ComObjects/AcceptanceCertificateContent
reading sources... [ 0%] ComObjects/AcceptanceCertificateItem
reading sources... [ 0%] ComObjects/AcceptanceCertificateSellerContent
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/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/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/sphinx/application.py", line 341, in build
self.builder.build_update()
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/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/diadocsdk-1c/envs/dev/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/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 468, in read
self._read_serial(docnames)
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 490, in _read_serial
self.read_doc(docname)
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 534, in read_doc
doctree = read_doc(self.app, self.env, self.env.doc2path(docname))
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/sphinx/io.py", line 318, in read_doc
pub.publish()
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/docutils/core.py", line 219, in publish
self.apply_transforms()
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/docutils/core.py", line 200, in apply_transforms
self.document.transformer.apply_transforms()
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/sphinx/transforms/__init__.py", line 90, in apply_transforms
Transformer.apply_transforms(self)
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
transform.apply(**kwargs)
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/sphinx/transforms/references.py", line 38, in apply
domain.process_doc(self.env, self.env.docname, self.document)
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/sphinx/domains/std.py", line 586, in process_doc
self.note_labels(env, docname, document)
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/sphinx/domains/std.py", line 638, in note_labels
n = node.traverse(addnodes.toctree)[0]
TypeError: 'generator' object is not subscriptable
Exception occurred:
File "/home/docs/checkouts/readthedocs.org/user_builds/diadocsdk-1c/envs/dev/lib/python3.7/site-packages/sphinx/domains/std.py", line 638, in note_labels
n = node.traverse(addnodes.toctree)[0]
TypeError: 'generator' object is not subscriptable
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 22 (12 by maintainers)
Commits related to this issue
- Pin docutils and add readthedocs config file A recent update in docutils breaks builds on readthedocs. This is the suggested work around from readthedocs [1]. [1] - https://github.com/readthedocs/re... — committed to simonsobs/socs by BrianJKoopman 3 years ago
- CI: Fix readthedocs build According to https://github.com/readthedocs/readthedocs.org/issues/8616 — committed to datalad/datalad-osf by adswa 3 years ago
- CI: Fix readthedocs build According to https://github.com/readthedocs/readthedocs.org/issues/8616 — committed to datalad-handbook/book by adswa 3 years ago
- Fix readthedocs build by pinning docutils version Fix issue where Sphinx doesn't work with docutils 0.18 by specifying a version constraint in docs/requirements.txt. More details: https://github.com/... — committed to LLNL/Umpire by davidbeckingsale 3 years ago
- Fix readthedocs build by pinning docutils version Fix issue where Sphinx doesn't work with docutils 0.18 by specifying a version constraint in docs/requirements.txt. More details: https://github.com/... — committed to LLNL/Umpire by davidbeckingsale 3 years ago
- Pin docutils and add readthedocs config file A recent update in docutils breaks builds on readthedocs. This is the suggested work around from readthedocs [1]. [1] - https://github.com/readthedocs/re... — committed to simonsobs/socs by BrianJKoopman 3 years ago
- chore(docs): lock docutils so RTD builds succeed ref https://github.com/readthedocs/readthedocs.org/issues/8616 — committed to jeabakker/Elgg by jeabakker 3 years ago
- Fix for readthedocs build: https://github.com/readthedocs/readthedocs.org/issues/8616#issuecomment-952034858 — committed to SUNET/cnaas-nms by indy-independence 3 years ago
- Fix readthedocs error https://github.com/readthedocs/readthedocs.org/issues/8616 — committed to openandclose/tosixinch by openandclose 3 years ago
- attempt to fix build see https://github.com/readthedocs/readthedocs.org/issues/8616#issuecomment-952982815 — committed to cryptomator/docs by overheadhunter 3 years ago
- Pin docutils according to https://github.com/readthedocs/readthedocs.org/issues/8616 to avoid build error — committed to clicon/clixon-docs by olofhagsand 3 years ago
- Move docs requirements into setup.py This should force Read the Docs to use latest Sphinx, thus avoiding the docutils dependency problem described in https://github.com/readthedocs/readthedocs.org... — committed to nickstenning/honcho by nickstenning 3 years ago
- try to fix rtd https://github.com/readthedocs/readthedocs.org/issues/8616 — committed to urswilke/miditapyr by urswilke 3 years ago
- fix(docs): fix readthedocs build https://github.com/readthedocs/readthedocs.org/issues/8616 — committed to desec-io/desec-stack by peterthomassen 3 years ago
- Fix RTD build readthedocs/readthedocs.org#8616 — committed to indico/indico by ThiefMaster 3 years ago
- Fix up ReadTheDocs publishing Closes #1054 Related to https://github.com/sphinx-doc/sphinx/issues/9788 Related to https://github.com/readthedocs/readthedocs.org/issues/8616 — committed to sigmavirus24/github3.py by sigmavirus24 3 years ago
- Add configuration files for Read the Docs Provide new configuration files for Read the Docs and its requirements. Related: https://github.com/readthedocs/readthedocs.org/issues/8616 — committed to poncovka/anaconda by poncovka 3 years ago
- Add configuration files for Read the Docs Provide new configuration files for Read the Docs and its requirements. Related: https://github.com/readthedocs/readthedocs.org/issues/8616 — committed to poncovka/anaconda by poncovka 3 years ago
- add readthedocs configuration files, fix problem related with: https://github.com/readthedocs/readthedocs.org/issues/8616 — committed to rcmdnk/homebrew-file by rcmdnk 3 years ago
- Fix ReadTheDocs builds docutils 0.18 is busted and needs to be prevented from being installed Related to https://github.com/sphinx-doc/sphinx/issues/9788 Related to https://github.com/readthedocs/r... — committed to PyCQA/flake8 by sigmavirus24 3 years ago
For future readers, the solution for this problem is to pin
docutils<0.18
in yourrequirements.txt
file, and have a.readthedocs.yaml
file with these contents:More information in our docs. See also our page on reproducible builds to better understand how to use requirements files on Read the Docs.
Please update the examples in the RTD documentation (https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html).
We now know that e.g.
is actually not good (as it pins a legacy Sphinx version but not the related Docutils).
With the requirements relaxed to
users will get the backported fix (Docutils pin added in 3.5). A a pin on not-fixed legacy Sphinx versions must be amended with a Docutils pin like, e.g.
Quick addendum:
I’ve seen this trip up projects where folks were already pinning Sphinx, only to find out that RTD wasn’t picking up those extra requirements.
Great summary originally posted by @joshuacwnewton in https://github.com/sphinx-doc/sphinx/issues/9783#issuecomment-952950115:
Update: Sphinx 1.8.6 was released this week, and it pins docutils to
<0.18
(thanks @tk0miya ❤️)However, users of old pip versions (for example on Python 2) might not benefit from this, and will need to pin docutils themselves anyway. Otherwise, they will still observe the error, plus this warning on the logs:
Well, there are some problems with trying to guess the version of docutils that users need. We actually used to install a pinned version of docutils as a pre-install step, but every dependency that we pin leads to confusion for users. Because of this, and all the confusing UX resulting from this, we’ve been moving away from pinning dependencies for users, and instead expect users to tell us what to install. At least this way you can easily replicate errors locally by just installing your dependencies. With Read the Docs magic helping in the middle, this isn’t possible and it gets even more confusing.
The problem is that if we pin
docutils==0.16
as a pre install step, that now satisfies the dependency from Sphinx 4 fordocutils<0.18
and docutils is never upgraded. Very few projects would ever know what docutils does, so this particular dependency is not likely to be pinned in a projects dependencies. Additionally, we aren’t doing any inspection of which version of Sphinx is installed, so would need to pre-install a docutils version for all projects.The best solution here is probably for Sphinx to backport release 1.x and 2.x releases, neither of which pin docutils at the moment. Sphinx 3.x does pin
docutils>=0.12,<0.17
at least, as does Sphinx 4.x. Alternatively, there needs to be a better error message emitted from docutils so users are left absolutely lost all of a sudden.Hi @anitagraser , I see in the logs that the
setup.py install
step is effectively bringing docutils 0.17, and still the error appears. I still don’t know what could have happened, feel free to open a new issue to analyze this case in depth.The version of
docutils
is not pinned and a new version was released.The build that passed installed
docutils-0.17.1-py2.py3-none-any.whl
and the one that failed, installeddocutils-0.18-py2.py3-none-any.whl