Installing eli5 in a blank environment installs jinja2 in version 3.1.1 which leads to the following error:
>>> import eli5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/eli5/__init__.py", line 6, in <module>
from .formatters import (
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/eli5/formatters/__init__.py", line 9, in <module>
from .html import format_as_html, format_html_styles
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/eli5/formatters/html.py", line 22, in <module>
template_env = Environment(
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/jinja2/environment.py", line 363, in __init__
self.extensions = load_extensions(self, extensions)
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/jinja2/environment.py", line 117, in load_extensions
extension = t.cast(t.Type["Extension"], import_string(extension))
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/jinja2/utils.py", line 149, in import_string
return getattr(__import__(module, None, None, [obj]), obj)
AttributeError: module 'jinja2.ext' has no attribute 'with_'
The with_-attribute was removed in version 3 of jinja2 as far as I can tell. Manually installing version 2.11.3 of jinja2 does not fix things on its own, since it has its own similar problem with markupsafe:
>>> import eli5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/eli5/__init__.py", line 6, in <module>
from .formatters import (
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/eli5/formatters/__init__.py", line 9, in <module>
from .html import format_as_html, format_html_styles
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/eli5/formatters/html.py", line 7, in <module>
from jinja2 import Environment, PackageLoader
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/jinja2/__init__.py", line 12, in <module>
from .environment import Environment
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/jinja2/environment.py", line 25, in <module>
from .defaults import BLOCK_END_STRING
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/jinja2/defaults.py", line 3, in <module>
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
File "/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/jinja2/filters.py", line 13, in <module>
from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/home/schoennenbeck/anaconda3/envs/eli5bug/lib/python3.8/site-packages/markupsafe/__init__.py)
This in turn can be fixed by installing markupsafe in version 1.1.1.
Simplest fix I can think of would be to add
jinja2<3
markupsafe<2
to the requirements.txt. However, I think it would be preferable to make the package compatible with the latest jinja2 version, since a lot of other packages now have jinja2>=3 as a requirement.
Installing eli5 in a blank environment installs jinja2 in version 3.1.1 which leads to the following error:
The
with_
-attribute was removed in version 3 of jinja2 as far as I can tell. Manually installing version 2.11.3 of jinja2 does not fix things on its own, since it has its own similar problem with markupsafe:This in turn can be fixed by installing markupsafe in version 1.1.1.
Simplest fix I can think of would be to add
to the requirements.txt. However, I think it would be preferable to make the package compatible with the latest jinja2 version, since a lot of other packages now have jinja2>=3 as a requirement.