I'm relatively new to using Sphinx and I've encountered an issue that I'm struggling to solve. I suspect the error might be related to the version of Sphinx I'm using, but attempts to resolve it with different versions have been unfruitful.
sphinx-build -b html docs/sphinx/source docs/sphinx/build
loading pickled environment... failed: Can't get attribute '_stable_repr_object' on <module 'sphinx.builders.html' from 'C:\\Users\\johndoe\\.conda\\envs\\johndoe_env\\lib\\site-packages\\sphinx\\builders\\html\\__init__.py'>
done
myst v2.0.0: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions={'amsmath', 'html_image', 'dollarmath', 'html_admonition', 'colon_fence', 'smartquotes', 'replacements', 'substitution', 'tasklist', 'strikethrough', 'deflist', 'fieldlist'}, disable_syntax=[], all_links_external=False, url_schemes=('http', 'https', 'mailto', 'ftp'), ref_
domains=None, fence_as_directive=set(), number_code_blocks=[], title_to_header=False, heading_anchors=2, heading_slug_func=None, html_meta={}, footnote_transition=True, words_per_minute=200, substitutions={}, linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=False, update_mathjax=True,
mathjax_classes='tex2jax_process|mathjax_process|math|output_area', enable_checkboxes=False, suppress_warnings=[], highlight_code_blocks=True)
2023-10-09T09:47:51.246657 [warning ] C:\Users\johndoe\.conda\envs\johndoe_envs\lib\site-packages\autoapi\mappers\python\mapper.py:293: RemovedInSphinx80Warning: The alias 'sphinx.util.status_iterator' is deprecated, use 'sphinx.util.display.status_iterator' instead. Check CHANGES for Sphinx API modifications.
for dir_root, path in sphinx.util.status_iterator(
thread_id=15556
[AutoAPI] Reading files... [ 4%] C:\Users\johndoe\PycharmProjects\BE\app\main.py
Extension error (autoapi.extension):
Handler <function run_autoapi at 0x000001A007B27AC0> for event 'builder-inited' threw an exception (exception: 'Module' object has no attribute 'doc')
Tried Solutions:
I have tried using different versions of Sphinx and Sphinx-AutoAPI. Specifically:
- Sphinx: 4.5 and 7.2.6
- Sphinx-AutoAPI: 2.1.0 and 1.2.1
All of the above were sourced from conda forge, but the issue persists.
Environment:
Here’s my conda environment setup in environment.yml:
- sphinx-book-theme
- myst-parser
- sphinx-autodoc-typehints
- graphviz
- linkify-it-py
- mistune=0.8.4
- sphinx-autoapi=2.1.0
- sphinxcontrib-openapi
- sphinx=4.5 # working version, 5+ seems not to work
- What might be causing the "Module object has no attribute 'doc'" error?
- Is this issue truly related to Sphinx versioning, or could there be another underlying issue?
Any guidance on how to resolve this issue would be greatly appreciated. Thank you in advance!
sphinx==4.5.0
andsphinx-autoapi==1.8.4
. It only started recently failing without any particular changes to my docs or explicit version requirements. I decided to update these requirements and withsphinx==6.2.1
andsphinx-autoapi==3.0.0
it is working again. – Doorpost