From ff5a9b5f6fbc7f9473bbb42ab14125e95bb090a8 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam <3275593+pradyunsg@users.noreply.github.com> Date: Mon, 28 Sep 2020 14:38:25 +0530 Subject: [PATCH] Merge pull request #8926 from uranusjr/dont-crash-on-check Don't crash on 'check' when METADATA is missing --- news/8676.feature | 2 ++ src/pip/_internal/operations/check.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 news/8676.feature diff --git a/news/8676.feature b/news/8676.feature new file mode 100644 index 000000000..f8da963f6 --- /dev/null +++ b/news/8676.feature @@ -0,0 +1,2 @@ +Improve error message friendliness when an environment has packages with +corrupted metadata. diff --git a/src/pip/_internal/operations/check.py b/src/pip/_internal/operations/check.py index 5714915bc..0d5963295 100644 --- a/src/pip/_internal/operations/check.py +++ b/src/pip/_internal/operations/check.py @@ -48,8 +48,8 @@ def create_package_set_from_installed(**kwargs): name = canonicalize_name(dist.project_name) try: package_set[name] = PackageDetails(dist.version, dist.requires()) - except RequirementParseError as e: - # Don't crash on broken metadata + except (OSError, RequirementParseError) as e: + # Don't crash on unreadable or broken metadata logger.warning("Error parsing requirements for %s: %s", name, e) problems = True return package_set, problems