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

Extension error on sphinx-build: cannot import name pass_context from jinja2 #59

Closed
jwg4 opened this issue Mar 6, 2022 · 3 comments
Closed

Comments

@jwg4
Copy link

jwg4 commented Mar 6, 2022

Hi, I am trying to add sphinx documentation to my project https://github.com/jwg4/flask-selfdoc (so the documentation is currently totally minimal. I was able to build the docs by running sphinx-build, however after adding "pallets_sphinx_themes" as an extension in docs/conf.py, setting the theme to 'flask' and installing pallets-sphinx-themes, I can no longer build the docs, as follows:

jack@yyy:~/flask-selfdoc $ poetry run sphinx-build -b html docs/ docs/_build/html
Running Sphinx v4.4.0

Extension error:
Could not import extension pallets_sphinx_themes (exception: cannot import name 'pass_context' from 'jinja2' (/home/jack/.cache/pypoetry/virtualenvs/flask-selfdoc-vTLo-IC6-py3.8/lib/python3.8/site-packages/jinja2/__init__.py))

I'm using Python 3.8.9, the attached poetry.lock shows all my dev environment dependencies including sphinx, jinja and this project.

poetry.lock.txt

I can try and reproduce minimally without all the other packages, but I wanted to check first in case I'm doing something obviously wrong. Thanks!

@jwg4
Copy link
Author

jwg4 commented Mar 6, 2022

The repo exactly as it was when I tried to build is at https://github.com/jwg4/flask-selfdoc/tree/sphinx_issue in case it helps anyone.

poetry install followed by the above poetry run command reproduce the issue on a clean checkout.

@davidism
Copy link
Member

davidism commented Mar 7, 2022

You'll need to upgrade Jinja to the latest version, or downgrade the themes to a version that does not use the latest Jinja.

@davidism davidism closed this as completed Mar 7, 2022
@jwg4
Copy link
Author

jwg4 commented Mar 8, 2022

Thanks very much, works now.

Perhaps the required version of jinja2, or a flask version which requires it, should be a dep of this package?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants