AttributeError: module 'jinja2.ext' has no attribute 'with_'

7.7k views Asked by At

I tried to install eli5 Python package via the below command in my google colab file.

!pip install eli5

And I'm getting this error when running the above command.

AttributeError: module 'jinja2.ext' has no attribute 'with_'

I tried to update jinja2 via the below commands, but it didn't resolve the issue.

!pip install --upgrade aiohttp_jinja2

!pip install --upgrade jinja2>=3.0

How to fix this issue?

2

There are 2 answers

1
Bohdan Sydorov On

This problem is caused by incorrect versioning of the jinja2 package inside the eli5 itself. There are some PRs that address this issue.

So you can:

  • wait for those PRs to be released in the new eli5 version

or

  • quickfix it by installing jinja2 of version 3.0.0 - 3.0.2

!pip install --upgrade jinja2>=3.0 didn't work because, I suppose, pip installed version greater than 3.0.2

0
thirumalesh On

I encounter the same problem, I debugged the issue with Pycharm. I search for the tag jinja2.ext and found one package using this. To resolve that issue, I updated the package to the latest version.

In my case, I updated the package Flask-DebugToolbar 0.11.0 to 0.13.1. It resolves my issue.