From 6930066b680d275338e5a6f52a432d1e17892c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Luis=20Cano=20Rodr=C3=ADguez?= Date: Thu, 3 Mar 2022 11:49:56 +0100 Subject: [PATCH 1/2] Present found conflicts when discarding some criterion Fixes gh-9254. Closes gh-10258. See https://github.com/pypa/pip/pull/10258#issuecomment-999060298 for inspiration. --- src/pip/_internal/resolution/resolvelib/reporter.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pip/_internal/resolution/resolvelib/reporter.py b/src/pip/_internal/resolution/resolvelib/reporter.py index a95a8e4cf24..3c724238a1e 100644 --- a/src/pip/_internal/resolution/resolvelib/reporter.py +++ b/src/pip/_internal/resolution/resolvelib/reporter.py @@ -42,6 +42,18 @@ def rejecting_candidate(self, criterion: Any, candidate: Candidate) -> None: message = self._messages_at_reject_count[count] logger.info("INFO: %s", message.format(package_name=candidate.name)) + msg = "Will try a different candidate, due to conflict:" + for req_info in criterion.information: + req, parent = req_info.requirement, req_info.parent + # Inspired by Factory.get_installation_error + msg += "\n " + if parent: + msg += f"{parent.name} {parent.version} depends on " + else: + msg += "The user requested " + msg += req.format_for_error() + logger.debug(msg) + class PipDebuggingReporter(BaseReporter): """A reporter that does an info log for every event it sees.""" From 1dc37f4f0854120051ab67cf12ff6e3eb7437aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Luis=20Cano=20Rodr=C3=ADguez?= Date: Sun, 26 Mar 2023 14:23:18 +0200 Subject: [PATCH 2/2] Add news entry --- news/10937.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/10937.feature.rst diff --git a/news/10937.feature.rst b/news/10937.feature.rst new file mode 100644 index 00000000000..2974c577a10 --- /dev/null +++ b/news/10937.feature.rst @@ -0,0 +1 @@ +Present conflict information during installation after each choice that is rejected (pass ``-vv`` to ``pip install`` to show it)