[BUG] vendored importlib.metadata of setuptools 60.9.0 fails with 'PathDistribution' object has no attribute '_normalized_name'
See original GitHub issuesetuptools version
setuptools==60.9.0
Python version
3.7.1
OS
Linux
Additional environment information
Pip freeze
argcomplete==1.12.3
colorlog==6.6.0
distlib==0.3.4
filelock==3.4.2
importlib-metadata==4.2.0
nox==2022.1.7
packaging==21.3
pip==22.0.3
platformdirs==2.5.0
py==1.11.0
pyparsing==3.0.7
setuptools==60.9.0
six==1.16.0
typing_extensions==4.1.1
virtualenv==20.13.1
wheel==0.37.1
zipp==3.7.0
Description
If I use the below python dependencies (mainly virtualenv, setuptools and importlib.metadata), setuptools fails with an error.
It works fine with the previous version of setuptools and newer versions of importlib.metadata. It seems like, that the current vendored version of importlib.metadata is not compatible with my environment.
Expected behavior
It should work fine
How to Reproduce
- Install the above dependencies
- Run
nox -s
Output
Traceback (most recent call last):
File "/usr/lib64/python3.7/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib64/python3.7/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib64/python3.7/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/root/git/empty_test/venv/lib/python3.7/site-packages/virtualenv/__init__.py", line 3, in <module>
from .run import cli_run, session_via_cli
File "/root/git/empty_test/venv/lib/python3.7/site-packages/virtualenv/run/__init__.py", line 14, in <module>
from .plugin.creators import CreatorSelector
File "/root/git/empty_test/venv/lib/python3.7/site-packages/virtualenv/run/plugin/creators.py", line 6, in <module>
from virtualenv.create.via_global_ref.builtin.builtin_way import VirtualenvBuiltin
File "/root/git/empty_test/venv/lib/python3.7/site-packages/virtualenv/create/via_global_ref/builtin/builtin_way.py", line 7, in <module>
from virtualenv.create.creator import Creator
File "/root/git/empty_test/venv/lib/python3.7/site-packages/virtualenv/create/creator.py", line 15, in <module>
from virtualenv.discovery.cached_py_info import LogCmd
File "/root/git/empty_test/venv/lib/python3.7/site-packages/virtualenv/discovery/cached_py_info.py", line 23, in <module>
_CACHE[Path(sys.executable)] = PythonInfo()
File "/root/git/empty_test/venv/lib/python3.7/site-packages/virtualenv/discovery/py_info.py", line 86, in __init__
self.distutils_install = {u(k): u(v) for k, v in self._distutils_install().items()}
File "/root/git/empty_test/venv/lib/python3.7/site-packages/virtualenv/discovery/py_info.py", line 152, in _distutils_install
d = dist.Distribution({"script_args": "--no-user-cfg"}) # conf files not parsed so they do not hijack paths
File "/root/git/empty_test/venv/lib/python3.7/site-packages/setuptools/dist.py", line 456, in __init__
for ep in metadata.entry_points(group='distutils.setup_keywords'):
File "/root/git/empty_test/venv/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 1003, in entry_points
return SelectableGroups.load(eps).select(**params)
File "/root/git/empty_test/venv/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 453, in load
ordered = sorted(eps, key=by_group)
File "/root/git/empty_test/venv/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 1001, in <genexpr>
dist.entry_points for dist in unique(distributions())
File "/root/git/empty_test/venv/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py", line 16, in unique_everseen
k = key(element)
AttributeError: 'PathDistribution' object has no attribute '_normalized_name'
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:6 (2 by maintainers)
Top Results From Across the Web
setuptools giving `TypeError` for minimal setup.py example
1 , I have to pass it a command. Running python setup.py build I don't get an error. Are you sure this is...
Read more >Building "web" container failing during `poetry install` in ...
Step 17/25 : RUN poetry "install" "--no-root" ---> Running in ... key(element) AttributeError: 'PathDistribution' object has no attribute '_normalized_name' ...
Read more >History - importlib-metadata - Read the Docs
#381: In PathDistribution._normalized_name , ensure names loaded from the stem of the filename are also normalized, ensuring duplicate entry points by packages ...
Read more >Package Discovery and Resource Access using pkg_resources
The pkg_resources module distributed with setuptools provides an API for Python libraries to access their resource files, and for extensible applications and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue, running Python 3.7.3 and poetry@latest.
Downgrade to
setuptools==60.8.2
fix the issue.I have the same issue, the setup is failing python 3.7.1 with poetry