Skip to content

Commit a2c5794

Browse files
committed
Bring back the "from versions:" message
In the new resolver the "(from versions ...)" message, shown on failure to resolve a package, has been removed. This commit brings it back.
1 parent 4b5b151 commit a2c5794

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

news/9139.feature.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bring back the "(from versions: ...)" message, that was shown on resolution failures.

src/pip/_internal/resolution/resolvelib/factory.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,17 @@ def _report_single_requirement_conflict(self, req, parent):
410410
req_disp = str(req)
411411
else:
412412
req_disp = f"{req} (from {parent.name})"
413+
414+
cands = self._finder.find_all_candidates(req.project_name)
415+
versions = [str(v) for v in sorted(set(c.version for c in cands))]
416+
413417
logger.critical(
414-
"Could not find a version that satisfies the requirement %s",
418+
"Could not find a version that satisfies the requirement %s "
419+
"(from versions: %s)",
415420
req_disp,
421+
", ".join(versions) or "none",
416422
)
423+
417424
return DistributionNotFound(f"No matching distribution found for {req}")
418425

419426
def get_installation_error(

0 commit comments

Comments
 (0)