Skip to content

Commit

Permalink
Bring back the "from versions:" message
Browse files Browse the repository at this point in the history
In the new resolver the "(from versions ...)" message, shown on
failure to resolve a package, has been removed. This commit brings it
back.
  • Loading branch information
MrMino committed Feb 27, 2021
1 parent 4b5b151 commit a2c5794
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/9139.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bring back the "(from versions: ...)" message, that was shown on resolution failures.
9 changes: 8 additions & 1 deletion src/pip/_internal/resolution/resolvelib/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,17 @@ def _report_single_requirement_conflict(self, req, parent):
req_disp = str(req)
else:
req_disp = f"{req} (from {parent.name})"

cands = self._finder.find_all_candidates(req.project_name)
versions = [str(v) for v in sorted(set(c.version for c in cands))]

logger.critical(
"Could not find a version that satisfies the requirement %s",
"Could not find a version that satisfies the requirement %s "
"(from versions: %s)",
req_disp,
", ".join(versions) or "none",
)

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

def get_installation_error(
Expand Down

0 comments on commit a2c5794

Please sign in to comment.