diff --git a/setuptools/_importlib.py b/setuptools/_importlib.py index 5317be0fa0..0e803565b6 100644 --- a/setuptools/_importlib.py +++ b/setuptools/_importlib.py @@ -10,3 +10,10 @@ import importlib_resources as resources # pragma: no cover else: import importlib.resources as resources # noqa: F401 + + +if not hasattr(metadata, "EntryPoints"): # pragma: no cover + raise ImportError( + "`importlib-metadata` version is incompatible with `setuptools`. " + "Please install importlib-metadata>=4.6" # Equivalent to stdlib's in 3.10 + )