Skip to content

Issue with Enum on Python3.11 #2904

@kalkun

Description

@kalkun

🐛 Bug description

Importing ignite.distributed fails on Python3.11.

To reproduce:

python3.11 -m pip install pytorch-ignite
python3.11 -c 'import ignite.distributed'

I get the following AttributeError:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/homebrew/lib/python3.11/site-packages/ignite/__init__.py", line 3, in <module>
    import ignite.engine
  File "/opt/homebrew/lib/python3.11/site-packages/ignite/engine/__init__.py", line 7, in <module>
    from ignite.engine.deterministic import DeterministicEngine
  File "/opt/homebrew/lib/python3.11/site-packages/ignite/engine/deterministic.py", line 11, in <module>
    from ignite.engine.engine import Engine
  File "/opt/homebrew/lib/python3.11/site-packages/ignite/engine/engine.py", line 13, in <module>
    from ignite.engine.events import CallableEventWithFilter, EventEnum, Events, EventsList, RemovableEventHandle, State
  File "/opt/homebrew/lib/python3.11/site-packages/ignite/engine/events.py", line 254, in <module>
    class Events(EventEnum):
  File "/opt/homebrew/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py", line 560, in __new__
    raise exc
  File "/opt/homebrew/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py", line 280, in __set_name__
    enum_member = enum_class._value2member_map_[value]
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/ignite/engine/events.py", line 200, in __hash__
    return hash(self._name_)
                ^^^^^^^^^^^
AttributeError: 'CallableEventWithFilter' object has no attribute '_name_'. Did you mean: 'name'?

Environment

  • PyTorch Version: 2.0.0
  • Ignite Version: 0.4.11
  • OS (e.g., Linux): macOS Ventura 13.2.1
  • How you installed Ignite: pip
  • Python version: 3.11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions