Hi Beat.
I prefer to invoke all Python-based tools with the same executable.
For example, instead of using "pip" or "pip3" (or who knows what), I use:
python3 -m pip install sphinx_rtd_theme
And the same thing for "sphinx-build":
python3 -m sphinx <source-dir> <build-dir>
More concretely, this could be:
python3 -m sphinx doc html-files
If you do it this way, you always know which Python version is used.
You can be even more specific and include the minor version if you want:
python3.8 -m ...
HTH.
cheers,
Matthias
On Tue, May 26, 2020 at 5:44 PM Beat Gurtner <[email protected]> wrote:
>
> After switch to a new macbook (Mac OS Catalina), my sphinx scripts are not
> working anymore:
>
> Sphinx v3.0.3 in Verwendung
>
> Configuration error:
> There is a programmable error in your configuration file:
>
> Traceback (most recent call last):
> File
> "/usr/local/Cellar/sphinx-doc/3.0.3/libexec/lib/python3.8/site-packages/sphinx/config.py",
> line 319, in eval_config_file
> execfile_(filename, namespace)
> File
> "/usr/local/Cellar/sphinx-doc/3.0.3/libexec/lib/python3.8/site-packages/sphinx/util/pycompat.py",
> line 81, in execfile_
> exec(code, _globals)
> File "/Applications/MAMP/htdocs/sakkadentrainer/doc/conf.py", line 43, in
> <module>
> import sphinx_rtd_theme
> ModuleNotFoundError: No module named 'sphinx_rtd_theme'
>
> I have installed the module sphinx_rtd_theme with:
>
> pip3 install rst2pdf
>
> Requirement already satisfied: rst2pdf in
> /Users/beatgurtner/Library/Python/3.7/lib/python/site-packages (0.97)
> Requirement already satisfied: jinja2 in
> /Users/beatgurtner/Library/Python/3.7/lib/python/site-packages (from rst2pdf)
> (2.11.2)
> Requirement already satisfied: pygments in
> /Users/beatgurtner/Library/Python/3.7/lib/python/site-packages (from rst2pdf)
> (2.6.1)
> Requirement already satisfied: pdfrw in
> /Users/beatgurtner/Library/Python/3.7/lib/python/site-packages (from rst2pdf)
> (0.4)
> Requirement already satisfied: smartypants in
> /Users/beatgurtner/Library/Python/3.7/lib/python/site-packages (from rst2pdf)
> (2.0.1)
> Requirement already satisfied: setuptools in
> /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages
> (from rst2pdf) (40.8.0)
> Requirement already satisfied: docutils in
> /Users/beatgurtner/Library/Python/3.7/lib/python/site-packages (from rst2pdf)
> (0.16)
> Requirement already satisfied: six in
> /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages
> (from rst2pdf) (1.12.0)
> Requirement already satisfied: reportlab in
> /Users/beatgurtner/Library/Python/3.7/lib/python/site-packages (from rst2pdf)
> (3.5.42)
> Requirement already satisfied: MarkupSafe>=0.23 in
> /Users/beatgurtner/Library/Python/3.7/lib/python/site-packages (from
> jinja2->rst2pdf) (1.1.1)
> Requirement already satisfied: pillow>=4.0.0 in
> /Users/beatgurtner/Library/Python/3.7/lib/python/site-packages (from
> reportlab->rst2pdf) (7.1.2)
> You are using pip version 19.0.3, however version 20.2b1 is available.
> You should consider upgrading via the 'pip install --upgrade pip' command.
>
> pip install --upgrade pip
> DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020.
> Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0
> will drop support for Python 2.7 in January 2021. More details about Python 2
> support in pip, can be found at
> https://pip.pypa.io/en/latest/development/release-process/#python-2-support
> Defaulting to user installation because normal site-packages is not writeable
> Requirement already up-to-date: pip in
> /Library/Python/2.7/site-packages/pip-20.2b1-py2.7.egg (20.2b1)
>
> I think it has nothing to do with the sphinx_rtd_theme itself, because if I
> comment this theme in conf.py I get the next error:
>
> Could not import extension rst2pdf.pdfbuilder (exception: No module named
> 'rst2pdf')
>
> But if I comment all extensions the script works without error:
>
> sphinx-build -D language=de -b html
> /Applications/MAMP/htdocs/sakkadentrainer/doc/
> /Applications/MAMP/htdocs/sakkadentrainer_medical_doc/de/
> Sphinx v3.0.3 in Verwendung
> Lade Übersetzungen [de]…erledigt
> loading pickled environment... failed
> Fehlgeschlagen: 'str' object has no attribute '__dict__'
> building [mo]: targets for 1 po files that are out of date
> writing output... [100%] locale/de/LC_MESSAGES/settings_general.mo
> building [html]: targets for 23 source files that are out of date
> updating environment: [new config] 23 added, 0 changed, 0 removed
> reading sources... [100%] train
> /Applications/MAMP/htdocs/sakkadentrainer/doc/medical_product.rst:: WARNING:
> image file not readable: img/konferkl_signed.png
> looking for now-outdated files... none found
> pickling environment... erledigt
> checking consistency... erledigt
> preparing documents... erledigt
> writing output... [100%] train
> generating indices... genindexerledigt
> writing additional pages... searcherledigt
> copying images... [100%] img/de/train_07.png
> copying static files... ... erledigt
> copying extra files... erledigt
> dumping search index in German (code: de)... erledigt
> dumping object inventory... erledigt
> build abgeschlossen, 1 warning.
>
> The HTML pages are in ../../sakkadentrainer_medical_doc/de.
>
>
> Answer from github:
>
> I think this problem is caused by your environment. Please check your python.
>
> Sphinx is installed under /usr/local/Celler.
>
> File
> "/usr/local/Cellar/sphinx-doc/3.0.3/libexec/lib/python3.8/site-packages/sphinx/config.py",
> line 319, in eval_config_file
>
> But your pip3 refers /Users/beatgurtner/Library/Python.
>
> Requirement already satisfied: rst2pdf in
> /Users/beatgurtner/Library/Python/3.7/lib/python/site-packages (0.97)
>
> I guess you installed multiple pythons in your PC. Please install
> sphinx_rtd_theme into the Python that Sphinx installed.
>
>
>
>
>
> My response:
>
>
>
> Yes, I have standard python 2.7 and 3.7
>
> python --version
> Python 2.7.16
>
> which python
> /usr/bin/python
>
> which python3
> /usr/bin/python3
> python3 --version
> Python 3.7.3
>
> I think for sphinx python 2.7 is enough...
>
> So how can I tell my system and sphinx to use 2.7?
>
> Do I have to change something in $PATH?
>
> echo $PATH
> /usr/local/opt/sphinx-doc/bin:/usr/local/opt/sphinx-doc/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
>
> Thanks for the help and sorry but for me this is all a bit of a mess ;)
>
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sphinx-users/d2828d67-9cec-41ab-a2d8-f4cc79e6200a%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sphinx-users/CAFesC-ctZ7dUZm4jDM6SneYHT5Ks%2B3E49uPt69XuvCYo%3DPRzgQ%40mail.gmail.com.