From 0a91572ac1d0175558aa47a07e85fe6a998ced7b Mon Sep 17 00:00:00 2001 From: sepehrrasooli Date: Thu, 20 Nov 2025 12:27:02 +0330 Subject: [PATCH 1/5] Remove extras from pip error message when installing packages --- src/pip/_internal/metadata/importlib/_dists.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pip/_internal/metadata/importlib/_dists.py b/src/pip/_internal/metadata/importlib/_dists.py index 89364b8b7ab..7768fea43cb 100644 --- a/src/pip/_internal/metadata/importlib/_dists.py +++ b/src/pip/_internal/metadata/importlib/_dists.py @@ -226,4 +226,5 @@ def iter_dependencies(self, extras: Collection[str] = ()) -> Iterable[Requiremen elif not extras and req.marker.evaluate({"extra": ""}): yield req elif any(req.marker.evaluate(context) for context in contexts): + req.marker = None yield req From d63cc78da573ff8cd82c1511e8aa2daaf7ed644b Mon Sep 17 00:00:00 2001 From: sepehrrasooli Date: Thu, 20 Nov 2025 12:34:53 +0330 Subject: [PATCH 2/5] Add news entry --- news/13618.bugfix.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 news/13618.bugfix.rst diff --git a/news/13618.bugfix.rst b/news/13618.bugfix.rst new file mode 100644 index 00000000000..cfe788aa70f --- /dev/null +++ b/news/13618.bugfix.rst @@ -0,0 +1,2 @@ +When installing packages, pip will no longer show a misleading +error message that included extra markers such as `; extra == "..."`. From a771dde0035861359728e5450f4a5f5fcaa9442b Mon Sep 17 00:00:00 2001 From: Sepehr Rasouli Date: Thu, 20 Nov 2025 12:43:35 +0330 Subject: [PATCH 3/5] Update 13618.bugfix.rst --- news/13618.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/13618.bugfix.rst b/news/13618.bugfix.rst index cfe788aa70f..6e3d6cae784 100644 --- a/news/13618.bugfix.rst +++ b/news/13618.bugfix.rst @@ -1,2 +1,2 @@ When installing packages, pip will no longer show a misleading -error message that included extra markers such as `; extra == "..."`. +error message that included extra markers such as ``; extra == "..."``. From 2c261c38de8f80864dd64b1c1d3e769ae1794a5d Mon Sep 17 00:00:00 2001 From: sepehrrasooli Date: Thu, 27 Nov 2025 11:28:01 +0330 Subject: [PATCH 4/5] Move removal of extra down the stack --- src/pip/_internal/metadata/importlib/_dists.py | 1 - src/pip/_internal/resolution/resolvelib/factory.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pip/_internal/metadata/importlib/_dists.py b/src/pip/_internal/metadata/importlib/_dists.py index 7768fea43cb..89364b8b7ab 100644 --- a/src/pip/_internal/metadata/importlib/_dists.py +++ b/src/pip/_internal/metadata/importlib/_dists.py @@ -226,5 +226,4 @@ def iter_dependencies(self, extras: Collection[str] = ()) -> Iterable[Requiremen elif not extras and req.marker.evaluate({"extra": ""}): yield req elif any(req.marker.evaluate(context) for context in contexts): - req.marker = None yield req diff --git a/src/pip/_internal/resolution/resolvelib/factory.py b/src/pip/_internal/resolution/resolvelib/factory.py index 07be5693d5e..7109e564134 100644 --- a/src/pip/_internal/resolution/resolvelib/factory.py +++ b/src/pip/_internal/resolution/resolvelib/factory.py @@ -708,7 +708,7 @@ def _report_single_requirement_conflict( "using the '-r' flag to install the packages listed in " "requirements.txt" ) - + req = str(req).partition(';')[0].strip() return DistributionNotFound(f"No matching distribution found for {req}") def _has_any_candidates(self, project_name: str) -> bool: From 5de2b1ad38d42ac807818f0baaf21464d78d7a5d Mon Sep 17 00:00:00 2001 From: sepehrrasooli Date: Thu, 27 Nov 2025 12:30:26 +0330 Subject: [PATCH 5/5] Fix linting issue --- src/pip/_internal/resolution/resolvelib/factory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pip/_internal/resolution/resolvelib/factory.py b/src/pip/_internal/resolution/resolvelib/factory.py index 7109e564134..cea07888cf3 100644 --- a/src/pip/_internal/resolution/resolvelib/factory.py +++ b/src/pip/_internal/resolution/resolvelib/factory.py @@ -708,8 +708,8 @@ def _report_single_requirement_conflict( "using the '-r' flag to install the packages listed in " "requirements.txt" ) - req = str(req).partition(';')[0].strip() - return DistributionNotFound(f"No matching distribution found for {req}") + req_str = str(req).partition(";")[0].strip() + return DistributionNotFound(f"No matching distribution found for {req_str}") def _has_any_candidates(self, project_name: str) -> bool: """