◐ Shell
clean mode source ↗

AttributeError: 'PathDistribution' object has no attribute '_normalized_name'

When importlib_metadata introduced the name normalization in PathDistributions starting in v4.3, it introduced a subtle incompatibility in select environments.

In particular, if a provider uses an older importlib metadata (importlib_metadata < 4.3 or importlib.metadata on Python < 3.10), and in that provider they supply PathDistributions, calls to resolve entry points will fail when any distribution doesn't have a _normalized_name attribute.

This issue was reported in several issues including:

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