Closed kuripart closed 1 year ago
Hi! I am running into the same issue trying to build libcamera's documentation on Arch Linux. This is with sphinx 7.0.0 and sphinx_rtd_theme 1.2.0 on Python 3.11.
Hi! Thanks for stopping by and reporting this!
Do you have an open source repo that produces this error?
There's no variables or properties in the theme's Python code called style
, so I wondered if it could be related to Jinja2 template code and found this:
As you can see, this code is guarded to only be used on old versions of Sphinx. But could the variable substitution still be causing the error?
The libcamera
named by David as an example failure above has its repo here and is open source.
Thanks! I'm wondering why some Sphinx 7 builds work fine. For instance, this build doesn't produce the error:
https://readthedocs.org/projects/test-builds/builds/20357244/
@polyzen found a fix for the libcamera issue :heart: https://paste.xinu.at/JfsPm/
It turned out to be not sphinx_rtd_theme related (just the use of a removed keyword). Sorry for the noise!
Thanks for sharing @dvzrv :+1:
@benjaoming @dvzrv Hi, sorry for disturbing! I see there are still style
(instead of styles[-1]
) used in sphinx-rtd-theme layout.html
. Is that still working for sphinx>=7.0.0
?
@ain-soph most people who ran into this issue were running an old version of sphinx-rtd-theme.
@ain-soph most people who ran into this issue were running an old version of sphinx-rtd-theme.
I agree. But it seems in the most up-to-date sphinx-rtd-theme layout.html
, it's still using style
variable, which is already deprecated in sphinx>=7.0
. I believe this would lead to compilation error for all docs using sphinx-rtd-theme on new sphinx versions.
@ain-soph It seems to work fine with Sphinx 7 because that statement is guarded by a version clause - see:
https://github.com/readthedocs/sphinx_rtd_theme/issues/1465#issuecomment-1531262630
Oops... I didn't even notice this if condition. Quite silly I am! 😓 Thanks for your time!
No worries, these issues are pretty complex to juggle :+1:
For anyone else hitting this after updating to Sphinx 7, make sure to also update the theme.
Working (old sphinx, old theme):
$ mamba list | grep sphinx
sphinx 6.2.1 pyhd8ed1ab_0 conda-forge
sphinx_rtd_theme 0.4.3 pyhd3eb1b0_0
sphinxcontrib-applehelp 1.0.4 pyhd8ed1ab_0 conda-forge
sphinxcontrib-devhelp 1.0.2 py_0 conda-forge
sphinxcontrib-htmlhelp 2.0.1 pyhd8ed1ab_0 conda-forge
sphinxcontrib-jsmath 1.0.1 py_0 conda-forge
sphinxcontrib-qthelp 1.0.3 py_0 conda-forge
sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_2 conda-forge
Failing (new sphinx, old theme):
$ mamba list | grep sphinx
sphinx 7.0.1 pyhd8ed1ab_0 conda-forge
sphinx_rtd_theme 0.4.3 pyhd3eb1b0_0
sphinxcontrib-applehelp 1.0.4 pyhd8ed1ab_0 conda-forge
sphinxcontrib-devhelp 1.0.2 py_0 conda-forge
sphinxcontrib-htmlhelp 2.0.1 pyhd8ed1ab_0 conda-forge
sphinxcontrib-jsmath 1.0.1 py_0 conda-forge
sphinxcontrib-qthelp 1.0.3 py_0 conda-forge
sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_2 conda-forge
Working (both sphinx and theme up to date):
$ mamba list | grep sphinx
sphinx 6.2.1 pyhd8ed1ab_0 conda-forge
sphinx_rtd_theme 1.2.2 pyha770c72_0 conda-forge
sphinxcontrib-applehelp 1.0.4 pyhd8ed1ab_0 conda-forge
sphinxcontrib-devhelp 1.0.2 py_0 conda-forge
sphinxcontrib-htmlhelp 2.0.1 pyhd8ed1ab_0 conda-forge
sphinxcontrib-jquery 4.1 pyhd8ed1ab_0 conda-forge
sphinxcontrib-jsmath 1.0.1 py_0 conda-forge
sphinxcontrib-qthelp 1.0.3 py_0 conda-forge
sphinxcontrib-serializinghtml 1.1.5 pyhd8ed1ab_2 conda-forge
I also encountered this as I didn't have some of my dependencies constrained and things upgraded into a failing state. I was able to use the last combination provided by @peterjc to get things working again.
Thanks!
Problem
Getting following error when building a Sphinx project:
conf.py
includes the following:Setting
html_style
doesn't fix the issue as well.Reproducible Project
Please give a link to a public reproducible project or provide an example of the Restructured Text that gives an issue.
Error Logs/Results
14 2.108 Theme error:
14 2.108 An error happened in rendering the page about.
14 2.108 Reason: UndefinedError("'style' is undefined")
Expected Results
Setting any other
html_theme
eg: 'bizstyle' works as expected.Environment Info
Happy to share the Dockerfile and Pipifile setting if the info provided is not enough.