Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0a91572
Remove extras from pip error message when installing packages
sepehr-rs Nov 20, 2025
d63cc78
Add news entry
sepehr-rs Nov 20, 2025
e9a70e1
Merge branch 'main' into fix-extras
sepehr-rs Nov 20, 2025
a771dde
Update 13618.bugfix.rst
sepehr-rs Nov 20, 2025
25bc54b
Merge branch 'main' into fix-extras
sepehr-rs Nov 27, 2025
2c261c3
Move removal of extra down the stack
sepehr-rs Nov 27, 2025
5de2b1a
Fix linting issue
sepehr-rs Nov 27, 2025
bbcc416
Merge branch 'main' into fix-extras
sepehr-rs Dec 1, 2025
72535ce
Merge branch 'main' into fix-extras
sepehr-rs Feb 2, 2026
a267d13
Merge branch 'main' into fix-extras
sepehr-rs Feb 11, 2026
c958efc
Update tests and coverage
sepehr-rs Feb 11, 2026
b7437f7
Merge branch 'main' into fix-extras
sepehr-rs Feb 18, 2026
9d0df20
Update code to address reviews
sepehr-rs Feb 18, 2026
cd747d0
Merge branch 'main' into fix-extras
sepehr-rs Apr 19, 2026
392b9b0
Update factory.py
sepehr-rs Apr 19, 2026
4299e88
Merge branch 'main' into fix-extras
sepehr-rs Apr 24, 2026
546106e
Update src/pip/_internal/resolution/resolvelib/factory.py
sepehr-rs Apr 24, 2026
08c9cf2
Update package_finder.py
sepehr-rs Apr 24, 2026
07c97b3
Merge branch 'main' into fix-extras
sepehr-rs Apr 25, 2026
3529911
Update src/pip/_internal/resolution/resolvelib/factory.py
sepehr-rs Apr 26, 2026
6fa1d71
Merge branch 'main' into fix-extras
sepehr-rs Apr 27, 2026
b3bfb30
Merge branch 'main' into fix-extras
sepehr-rs May 30, 2026
f342f7e
Merge branch 'main' into fix-extras
sepehr-rs May 31, 2026
2b57bdf
Merge branch 'main' into fix-extras
sepehr-rs Jun 9, 2026
fd84d17
Merge branch 'main' into fix-extras
sepehr-rs Jun 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/13618.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
When installing packages, pip will no longer show a misleading
error message that included extra markers such as ``; extra == "..."``.
9 changes: 6 additions & 3 deletions src/pip/_internal/index/package_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,16 +1014,19 @@ def _format_versions(cand_iter: Iterable[InstallationCandidate]) -> str:
)
if allows_pre is False:
version_type = "final version"

# pip sometimes includes environment markers like `;extra == "foo"`
# in requirement strings, which is confusing in error messages.
# Strip them so the user sees only the actual missing requirement.
req_disp = re.sub(r';\s*extra\s*==\s*".*?"', "", str(req)).strip()
logger.critical(
"Could not find a %s that satisfies the requirement %s "
"(from versions: %s)",
version_type,
req,
req_disp,
_format_versions(best_candidate_result.all_candidates),
)

raise DistributionNotFound(f"No matching distribution found for {req}")
raise DistributionNotFound(f"No matching distribution found for {req_disp}")

def _should_install_candidate(
candidate: InstallationCandidate | None,
Expand Down
6 changes: 3 additions & 3 deletions src/pip/_internal/resolution/resolvelib/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import copy
import functools
import logging
import re
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -724,7 +725,7 @@ def _report_single_requirement_conflict(
req_disp = str(req)
else:
req_disp = f"{req} (from {parent.name})"

req_disp = re.sub(r';\s*extra\s*==\s*".*?"', "", req_disp).strip()
cands = self._finder.find_all_candidates(req.project_name)
skipped_by_requires_python = self._finder.requires_python_skipped_reasons()

Expand Down Expand Up @@ -776,8 +777,7 @@ def _report_single_requirement_conflict(
"using the '-r' flag to install the packages listed in "
"requirements.txt"
)

return DistributionNotFound(f"No matching distribution found for {req}")
return DistributionNotFound(f"No matching distribution found for {req_disp}")

def _has_any_candidates(self, project_name: str) -> bool:
"""
Expand Down
4 changes: 4 additions & 0 deletions tests/functional/test_install_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ def test_install_special_extra(
assert (
"Could not find a version that satisfies the requirement missing_pkg"
) in result.stderr, str(result)
assert "No matching distribution found for missing_pkg" in result.stderr, str(
result
)
assert "extra ==" not in result.stderr, str(result)
Comment thread
sepehr-rs marked this conversation as resolved.


@pytest.mark.network
Expand Down
Loading