L.rocky
L.rocky

Reputation: 79

sphinx_rtd_theme is no longer a hard dependency since version 1.4.0

C:\Users\Administrator\Desktop\item\code_serv\documents\api>make html Running Sphinx v1.6.2 loading pickled environment... failed:

Can't get attribute 'WarningStream' on <module 'sphinx.util.nodes' from 'c:\\users\\administrator\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\sphinx\\util\\nodes.py'>

Theme error:

sphinx_rtd_theme is no longer a hard dependency since version 1.4.0. Please install it manually.(pip install sphinx_rtd_theme)

How do I solve this?

Upvotes: 5

Views: 8905

Answers (3)

sxm1972
sxm1972

Reputation: 752

I had the same problem on a Windows 10 Pro laptop. I had installed Python 3.9 from the Windows store. I had to first find where Python and pip applications were installed and add that to the PATH variable. This was in a folder that was looked:

c:\users\<username>\appdata\local\programs\python\python39\Scripts

Then I installed sphinx using:

pip install -U sphinx

Then I had to set the SPHINXBUILD env variable to the right value:

SPHINXBUILD="c:\users\<username>\appdata\local\programs\python\python39\Scripts\sphinx-build.exe"

When I tried to use the sphinx_rtd_theme I kept getting the error:

Theme error:
sphinx_rtd_theme is no longer a hard dependency since version 1.4.0. Please install it 
manually.(pip install sphinx_rtd_theme)

I ran the following command:

pip install sphinx_rtd_theme

But when I tried to run make html it gave the error:

Running Sphinx v3.5.1

Configuration error:
There is a syntax error in your configuration file: bad input (conf.py, line 57)

Finally I had to make the following changes in my conf.py file:

# Add this to the top of the conf.py file
import os
import sys
sys.path.insert(0, os.path.abspath('C:\\Users\\ <username>\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\site-packages'))
import sphinx_rtd_theme

extensions = [
   "sphinx_rtd_theme",
]

It looks like sphinx-build is not able to get the location of the sphinx_rtd_theme package unless you give the explicit path in the manner above. “¯_(ツ)_/¯“

Upvotes: 0

shailesh mangal
shailesh mangal

Reputation: 322

I found another issue, I had two installations of sphinx, one via pip and another one via brew. Deleting one (I chose to remove installation done via brew ) solved this issue.

brew remove sphinx-doc

If it still doesnt work, try uninstalling and reinstalling

pip3  uninstall sphinx sphinx_rtd_theme
pip3  install sphinx sphinx_rtd_theme

Upvotes: 6

Marcelo Alcocer
Marcelo Alcocer

Reputation: 1

In my case (building from RTD theme source), the problem seemed to be caused by a change in behaviour of the html_theme_path config value in conf.py. Whilst paths relative to the makefile directory used to be accepted, paths must now be relative to the configuration directory:

html_theme_path

A list of paths that contain custom themes, either as subdirectories or as zip files. Relative paths are taken as relative to the configuration directory.

New in version 0.6.

Sphinx documentation > Configuration

Upvotes: 0

Related Questions