Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion docs/html/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,10 @@ To setup for bash::

To setup for zsh::

python -m pip completion --zsh >> ~/.zprofile
python -m pip completion --zsh >> ~/.zshrc

# Requires zsh completion (compinit) to be enabled.


To setup for fish::

Expand Down
1 change: 1 addition & 0 deletions news/13811.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deduplicate repeated invalid metadata warnings for the same location.
2 changes: 1 addition & 1 deletion src/pip/_internal/index/package_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ def _format_versions(cand_iter: Iterable[InstallationCandidate]) -> str:
_format_versions(best_candidate_result.all_candidates),
)

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

def _should_install_candidate(
candidate: InstallationCandidate | None,
Expand Down
5 changes: 4 additions & 1 deletion src/pip/_internal/metadata/importlib/_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class _DistributionFinder:

def __init__(self) -> None:
self._found_names: set[NormalizedName] = set()
self._warned_bad_metadata: set[BasePath | None] = set()

def _find_impl(self, location: str) -> Iterator[FoundResult]:
"""Find distributions in a location."""
Expand All @@ -69,7 +70,9 @@ def _find_impl(self, location: str) -> Iterator[FoundResult]:
try:
name = get_dist_canonical_name(dist)
except BadMetadata as e:
logger.warning("Skipping %s due to %s", info_location, e.reason)
if info_location not in self._warned_bad_metadata:
logger.warning("Skipping %s due to %s", info_location, e.reason)
self._warned_bad_metadata.add(info_location)
continue
if name in self._found_names:
continue
Expand Down
4 changes: 3 additions & 1 deletion src/pip/_internal/resolution/resolvelib/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,9 @@ def _report_single_requirement_conflict(
"requirements.txt"
)

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

def _has_any_candidates(self, project_name: str) -> bool:
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_new_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def test_new_resolver_no_dist_message(script: PipTestEnvironment) -> None:
assert (
"Could not find a version that satisfies the requirement B" in result.stderr
), str(result)
assert "No matching distribution found for B" in result.stderr, str(result)
assert "no matching distribution found for b" in result.stderr.lower(), str(result)


def test_new_resolver_installs_editable(script: PipTestEnvironment) -> None:
Expand Down