`AttributeError: 'EntryPoints' object has no attribute 'get'` raised when using flake8 with Python 3.12
ehogan opened this issue · comments
Emma Hogan commented
how did you install flake8?
$ conda create --name test-flake8 python=3.12 flake8
unmodified output of flake8 --bug-report
Traceback (most recent call last):
File "/conda/envs/test-flake8/bin/flake8", line 10, in <module>
sys.exit(main())
^^^^^^
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main
app.run(argv)
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run
self._run(argv)
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run
self.initialize(argv)
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize
self.find_plugins(config_finder)
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins
self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__
self.manager = PluginManager(
^^^^^^^^^^^^^^
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__
self._load_entrypoint_plugins()
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins
eps = importlib_metadata.entry_points().get(self.namespace, ())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'EntryPoints' object has no attribute 'get'
describe the problem
what I expected to happen
When I run any flake8
command using the version of flake8 from the Conda environment (created as above) I get the same traceback (provided above and below).
I do not see this problem if I specify python=3.11
when creating the Conda environment.
commands ran
$ flake8 --help
Traceback (most recent call last):
File "/conda/envs/test-flake8/bin/flake8", line 10, in <module>
sys.exit(main())
^^^^^^
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main
app.run(argv)
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 375, in run
self._run(argv)
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 363, in _run
self.initialize(argv)
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 343, in initialize
self.find_plugins(config_finder)
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/main/application.py", line 157, in find_plugins
self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 363, in __init__
self.manager = PluginManager(
^^^^^^^^^^^^^^
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 243, in __init__
self._load_entrypoint_plugins()
File "/conda/envs/test-flake8/lib/python3.12/site-packages/flake8/plugins/manager.py", line 261, in _load_entrypoint_plugins
eps = importlib_metadata.entry_points().get(self.namespace, ())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'EntryPoints' object has no attribute 'get'
Thank you! :)
Anthony Sottile commented
you are using a very old version of flake8 -- please search the issue tracker next time there are several duplicates and resolutions