Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build project #923

Closed
Aericio opened this issue May 11, 2020 · 6 comments
Closed

Unable to build project #923

Aericio opened this issue May 11, 2020 · 6 comments
Labels
Needed: more information A reply from issue author is required Support Support question

Comments

@Aericio
Copy link

Aericio commented May 11, 2020

Problem

I'm currently trying to build the project with the theme, but for some reason it says No module named 'sphinx_rtd_theme'. I've already installed the with pip install sphinx_rtx_theme, then uninstall & reinstall, still same thing.

Reproducible Project

conf.py:

import sphinx_rtd_theme
...
extensions = [
    'sphinx.ext.doctest',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.mathjax',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages',
    'sphinx_rtd_theme',
]
...
html_theme = 'sphinx_rtd_theme'

requirements.txt:

sphinx
sphinx_rtd_theme

Error Logs/Results

If I only changed html_theme, then this happens. I did do pip install sphinx_rtd_theme and ran make file again, but still told me to install it manually.

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)
Makefile:19: recipe for target 'html' failed
make: *** [html] Error 1

I searched around google and stumbled upon this: https://sphinx-rtd-theme.readthedocs.io/en/latest/installing.html , so then I added import and extensions and this was the issue instead. Again tried to install sphinx_rtd_theme but now this occurs.

aericio@DESKTOP-K0KSOQU:~/rtd$ make html
Running Sphinx v1.6.7
making output directory...

Configuration error:
There is a programable error in your configuration file:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sphinx/config.py", line 157, in __init__
    execfile_(filename, config)
  File "/usr/lib/python3/dist-packages/sphinx/util/pycompat.py", line 150, in execfile_
    exec_(code, _globals)
  File "conf.py", line 23, in <module>
    import sphinx_rtd_theme
ModuleNotFoundError: No module named 'sphinx_rtd_theme'

Makefile:20: recipe for target 'html' failed
make: *** [html] Error 1

Expected Results

It should have built. Also, with the default install theme it built perfectly fine.

Environment Info

  • Python Version: 2.7.17 (I also have python 3.6.9 installed)
  • Sphinx Version: 1.8.5
  • RTD Theme Version: 1.1.2
    Also using Ubuntu 18.04 LTS on WSL.
@agjohnson
Copy link
Collaborator

If you are indeed using Sphinx 1.8.5, it looks like your environment is not set up correctly. Sphinx reports version 1.6.7 in your output above, which maybe implies it's running sphinx from the system/etc path? The theme likely isn't installed in this same site path.

@agjohnson agjohnson added Support Support question Needed: more information A reply from issue author is required labels May 11, 2020
@Aericio
Copy link
Author

Aericio commented May 12, 2020

I see! I entered root user and did pip install sphinx_rtd_theme and now it works fine. make html is also using latest version, 1.8.5.

Any issues with it being installed on root (like security or something), and would I be able to remove it from /home/user/.local now since its in etc?

@agjohnson
Copy link
Collaborator

It sounds like you probably want to set up a virtualenv, I'd look for some guides on how to use virtualenv or pyenv to maintain the dependencies for your documentation. Generally, you shouldn't need to alter the system packages or run as root to build you documentation.

Closing this as virtualenv setup is outside the scope of the theme.

@mfarmani
Copy link

@Aericio Did you solve the issue?

@Aericio
Copy link
Author

Aericio commented Dec 17, 2022

Yes. I don't remember exactly, but according to my message above, I just logged into root and the installation worked.

I didn't bother setting up a virtualenv since it wasn't a big deal for me to enter into root, if you were wondering about that.

@buhtz
Copy link

buhtz commented Oct 26, 2023

Just want to add my solution.
I avoid to use requirements.txt file because it is redundant to a pyprojects.toml file.
But specific to my project I do not have a pyprojects.toml file yet.

My solution is just to use the "post_create_environment" step to explicit install the missing package via pip.

build:
  os: ubuntu-22.04
  tools:
    python: "3"
  jobs:
    post_create_environment:
      - python -m pip install sphinx_rtd_theme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needed: more information A reply from issue author is required Support Support question
Projects
None yet
Development

No branches or pull requests

4 participants