Skip to content

AttributeError when importing eli5 0.11.0 #417

@dvorst

Description

@dvorst

When importing eli5, I receive the error shown below. I have version 0.11.0 installed and use Python 3.10

Traceback (most recent call last):
  File "C:\Users\user\PycharmProjects\resume keywords\main.py", line 2, in <module>
    import eli5
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\eli5\__init__.py", line 6, in <module>
    from .formatters import (
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\eli5\formatters\__init__.py", line 9, in <module>
    from .html import format_as_html, format_html_styles
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\eli5\formatters\html.py", line 22, in <module>
    template_env = Environment(
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\jinja2\environment.py", line 363, in __init__
    self.extensions = load_extensions(self, extensions)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\jinja2\environment.py", line 117, in load_extensions
    extension = t.cast(t.Type["Extension"], import_string(extension))
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\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_'

EDIT:
I have tried installing other versions of Jinja2.

  • the error occurs with versions: 3.1.2, 3.1.1, 3.1.0.
  • the error does not occur with version 3.0.3

EDIT2:
When fixing this error, I encountered two others, both of these are due to using scikit-learn version 1.0.2

  • ModuleNotFoundError: No module named 'sklearn.metrics.scorer'
  • ModuleNotFoundError: No module named 'sklearn.feature_selection.base'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions