diff --git a/src/pip/_internal/metadata/__init__.py b/src/pip/_internal/metadata/__init__.py index f4f2a4f6cdb..58d7f890294 100644 --- a/src/pip/_internal/metadata/__init__.py +++ b/src/pip/_internal/metadata/__init__.py @@ -47,5 +47,12 @@ def get_wheel_distribution(wheel: Wheel, canonical_name: str) -> BaseDistributio :param canonical_name: Normalized project name of the given wheel. """ from .pkg_resources import Distribution - - return Distribution.from_wheel(wheel, canonical_name) + from zipfile import BadZipFile + + try: + return Distribution.from_wheel(wheel, canonical_name) + except BadZipFile as e: + raise RuntimeError( + "Unable to retrieve wheel {} with canonical name {}" + .format(wheel.location, canonical_name) + ) from e