after installing this theme in virtual environment I've got "Theme error".
I do see "missing theme.conf" in the folder "venv/lib/python3.7/site-packages/python_docs_theme" but "make html" produces an error.
How can this error be fixed?
Hmm, i also got this error, after looking around for a while, finally found it:
conf.py for your sphinx project should contain something like:
extensions = [ ....., 'python_docs_theme', ]
and further on:
html_theme = 'python_docs_theme'
Pay special attention to the _ (underscore); don't use - (minus sign).
Works like a charm.
Grtx,
Ben
Reacted by Fei Yang, Sophia Lawal and Valeria Barra
I can confirm the issue as described above, for Python 3.8.2 on macOS with Sphinx 3.1.2, and also that it went away after adding 'python_docs_theme' to extensions.
I think the installation instructions on the README page should be updated accordingly (unless someone volunteers to find out why exactly it works without adding 'python_docs_theme' to extensions for the Python 3 docs).
I have created PR #48 to address this issue. Afterwards, I saw there is already PR #32 that addresses this similarly, but needs to be rebased. Let me know how to proceed there.
Setting the html_theme = "python_docs_theme" tries to import the package python_docs_theme as a plugin which obviously works. Similarly, html_theme = "python-docs-theme" tries to import the package python-docs-theme as a plugin which obviously does not work.
I also had this issue with identical symptoms as the OP. The cause in my case was that Sphinx wasn't installed in the virtualenv that was activated. The Sphinx makefile would still run, but it was finding Sphinx outside of the virtualenv so the errors were very misleading.
Fix was simply
pip install sphinx
and then adding it to my requirements.txt so that readthedocs would work as expected.
The Sphinx makefile would still run, but it was finding Sphinx outside of the virtualenv so the errors were very misleading.
- @ scott-griffiths at #45 (comment)
thanks a lot.
for me, the issue was that i had not activated the .venv.
i am using pdm build system, and so-far, i never needed to activate that due to it
but yeah, for sphinx-build used by make html, source .venv/Scripts/activate fixed it :)
looks like it's time to explore direnv or the like :D
orrr, better yet, change the makefile lol 😄. no need to activate it again 😆
- SPHINXBUILD ?= sphinx-build+ SPHINXBUILD ?= pdm run sphinx-build
Activity
beijersb commented on Jun 11, 2020
Hmm, i also got this error, after looking around for a while, finally found it:
conf.py for your sphinx project should contain something like:
extensions = [ ....., 'python_docs_theme', ]
and further on:
html_theme = 'python_docs_theme'
Pay special attention to the _ (underscore); don't use - (minus sign).
Works like a charm.
Grtx,
Ben
JulienPalard commented on Jun 15, 2020
Interestingly, cpython just has html_theme = 'python_docs_theme', and we're not having the issue.
andy-maier commented on Jul 21, 2020
I can confirm the issue as described above, for Python 3.8.2 on macOS with Sphinx 3.1.2, and also that it went away after adding 'python_docs_theme' to extensions.
I think the installation instructions on the README page should be updated accordingly (unless someone volunteers to find out why exactly it works without adding 'python_docs_theme' to extensions for the Python 3 docs).
Added info about updating the conf.py file to README file
andy-maier commented on Jul 21, 2020
I have created PR #48 to address this issue. Afterwards, I saw there is already PR #32 that addresses this similarly, but needs to be rebased. Let me know how to proceed there.
JulienPalard commented on Jul 23, 2020
I checked the following steps on Debian:
and it worked as expected, no need to edit extensions for me.
Can someone having the issue try this to compare?
Mariatta commented on Sep 14, 2020
For the core sprint repo, we only added the html_theme='python_docs_theme', using Python 3.8.3 and sphinx 3.2.1.
I think it's not needed to add it to extensions.
pradyunsg commented on May 1, 2021
I can confirm that the issue here is the - vs _.
Setting the html_theme = "python_docs_theme" tries to import the package python_docs_theme as a plugin which obviously works. Similarly, html_theme = "python-docs-theme" tries to import the package python-docs-theme as a plugin which obviously does not work.
This can be closed IMO.
JulienPalard commented on May 1, 2021
Thanks @pradyunsg, and I agree, I'm closing this.
scott-griffiths commented on Sep 1, 2022
I also had this issue with identical symptoms as the OP. The cause in my case was that Sphinx wasn't installed in the virtualenv that was activated. The Sphinx makefile would still run, but it was finding Sphinx outside of the virtualenv so the errors were very misleading.
Fix was simply
pip install sphinx
and then adding it to my requirements.txt so that readthedocs would work as expected.
peterjpxie commented on Jan 24, 2023
@scott-griffiths 's fix works for me. Thanks!
My environment:
Ubuntu 22.04, it comes with sphinx pre-installed at system path /usr/bin/sphinx-build.
The same issue happens if I follow https://www.sphinx-doc.org/en/master/usage/installation.html#linux to install on Ubuntu16.04:
goyalyashpal commented on Mar 28, 2024
thanks a lot.
for me, the issue was that i had not activated the .venv.
i am using pdm build system, and so-far, i never needed to activate that due to it
but yeah, for sphinx-build used by make html, source .venv/Scripts/activate fixed it :)
looks like it's time to explore direnv or the like :D
orrr, better yet, change the makefile lol 😄. no need to activate it again 😆