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: Could not import extension nbsphinx (exception: cannot import name 'contextfilter' from 'jinja2') #710

Closed
lneuhaus opened this issue Feb 16, 2023 · 2 comments

Comments

@lneuhaus
Copy link

lneuhaus commented Feb 16, 2023

When I try using nbsphinx (latest version from pip 0.8.12) together with the latest version of Jinja2 (3.1.2), I get the following error:

Extension error: Could not import extension nbsphinx (exception: cannot import name 'contextfilter' from 'jinja2') (/home/.../lib/python3.9/site-packages/jinja2/__init__.py)) make: *** [Makefile:60: html] Error 2

I believe jinja2 might have silently broken its public API, or maybe contextfilter was never part of that public API, don't know. Maybe there is a workaround here?

@lneuhaus
Copy link
Author

lneuhaus commented Feb 16, 2023

see https://github.com/pallets/jinja/blob/05a5f8120a62f2e1da322131c632be2ba8d969fc/src/jinja2/utils.py#L40 - seems one is supposed to use pass_context() instead of contextfilter now. And in the tagged github version 3.0.0, this change has already happened, but I suppose the PyPI version 3.0.0 is not that one, but maybe corresponds to tag 3.0.0a1 or so https://github.com/pallets/jinja/blob/3.0.0a1/src/jinja2/utils.py or so, where it's still called contextfilter.

@lneuhaus
Copy link
Author

Ah, I now see this is a duplicate of jupyter/nbconvert#1742, and it belongs there..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant