Sphinx Read-The-Docs Theme recognised but not "found"
Asked Answered
N

5

17

I downloaded the read-the-docs theme for sphinx from Github and put it into the _themes folder.

conf.py:

html_theme = "sphinx_rtd_theme"
html_theme_path = ["_themes", ]

However, running "make html" I get this error:

Sphinx v4.1.2 in Verwendung
Lade Übersetzungen [de]…erledigt
loading pickled environment... erledigt
WARNING: sphinx_rtd_theme (< 0.3.0) found. It will not be available since Sphinx-6.0

Theme error:
no theme named 'sphinx_rtd_theme' found (missing theme.conf?)

Somehow Sphinx seems to find the theme and then disregard it. Can someone tell me what is happening and how I can fix it?

Nor answered 16/9, 2021 at 9:49 Comment(6)
I think you should install the theme using "pip install sphinx-rtd-theme" (pypi.org/project/sphinx-rtd-theme)Divulgence
That's right then it works. But I have another problem with templates in the _templates folder that don't trigger with the global theme installation via ´pip install sphinx-rtd-theme´Nor
I don't know what you mean by "trigger with the global theme installation".Divulgence
@Divulgence sorry, solved. I created the _templates folder at the wrong hierarchical level... To get back to the original question: Is the way via git repo not supported anymore then?Nor
Has it ever been supported to do it by downloading from GitHub?Divulgence
Yes apparently but it says it's deprecated (look at the bottom) sphinx-rtd-theme.readthedocs.io/en/stable/installing.htmlNor
D
28

Need to install:

pip install sphinx-rtd-theme
Discreditable answered 30/3, 2022 at 19:0 Comment(3)
this text coul be provided as a comment instead of a full answerPreoccupy
I do have sphinx-rtd-theme installed and still does not work.Melanimelania
@SomeDev Don't know if this helps, but I'm on an M1 and had the same issue. It's installed, pip throws "Requirement already satisfied" when trying to install it. I got around it by commenting out the 'html_theme = "sphinx_rtd_theme"' from the conf.py file. Not sure what the impact is, but the HTML generated ok for me after that.Dank
M
14

I solved it! (not the same as OP, since he did not have the package installed, but maybe it'll be useful for somebody)

If it doesn't work for you, be sure to use underscores in the conf.py file as the package uses normal dashes.

In conf.py it should be like this html_theme = 'sphinx_rtd_theme' not like this html_theme = 'sphinx-rtd-theme'

https://pypi.org/project/sphinx-rtd-theme/

Melanimelania answered 7/6, 2022 at 22:19 Comment(0)
S
2

I solved this problem using a requirements.txt file, which I used to install the sphinx_rtd_theme module. Follow the steps mentioned, and I assume you have a GitHub repo connected with readthedocs server.

  1. Add the following lines in your .ymal file
python:
   install:
     - requirements: docs/requirements.txt
  1. Now place a requirements.txt file in the location specified above with the following text

    sphinx-rtd-theme

  2. Add, commit and push the changes to the origin and enjoy!

Softy answered 11/1, 2024 at 22:6 Comment(0)
B
0

I solved it using the underscore point mentioned by Some Dev, but I also needed to update pip to the latest version:

python.exe -m pip install --upgrade pip
Budgie answered 15/12, 2022 at 13:16 Comment(1)
Please wrap command text using backticks stackoverflow.com/editing-help#code-spansSempiternal
S
0

If you are using venv - you should restart your shell. It worked for me.

Selfimmolation answered 6/8, 2024 at 16:13 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.