Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BUG: [py3.11] AttributeError: 'PathDistribution' object has no attribute '_normalized_name' #98706

Copy link
Copy link
Closed
@h-vetinari

Description

@h-vetinari
Issue body actions

This shows up while trying to run the numpy test suite with python 3.11 and the newest pytest etc.

==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________

[...]

=========================== short test summary info ============================
ERROR  - AttributeError: 'PathDistribution' object has no attribute '_normalized_name'
ERROR  - AttributeError: 'PathDistribution' object has no attribute '_normalized_name'
2 errors in 1.41s

More precisely, the error appears in the vendored import_lib module

[...]/lib/python3.11/importlib/metadata/__init__.py:472: in load
    ordered = sorted(eps, key=by_group)
        by_group   = operator.attrgetter('group')
        cls        = <class 'importlib.metadata.SelectableGroups'>
        eps        = <itertools.chain object at 0x7f19804ea5f0>
[...]/lib/python3.11/importlib/metadata/__init__.py:1013: in <genexpr>
    eps = itertools.chain.from_iterable(
        .0         = <generator object unique_everseen at 0x7f19805e9d40>
[...]/lib/python3.11/importlib/metadata/_itertools.py:16: in unique_everseen
    k = key(element)
E   AttributeError: 'PathDistribution' object has no attribute '_normalized_name'
        element    = <importlib_metadata.PathDistribution object at 0x7f19802c0450>
        iterable   = <itertools.chain object at 0x7f19804eae00>
        key        = operator.attrgetter('_normalized_name')
        seen       = set()
        seen_add   = <built-in method add of set object at 0x7f198035b060>

Turns out this is python/importlib_metadata#396 (fixed in 4.13.0), where @jaraco noted:

Perhaps importlib_metadata should provide a compatibility shim to honor name normalization in distributions not supplying it (or at least not crash).

Unfortunately, the vendored version present in python 3.11 is only at 4.11.3, hence does not carry the fix.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.