From eafbec5aa6c169c41975a4d3327a5286b26fa128 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Thu, 16 Jul 2020 13:08:32 +0530 Subject: [PATCH] Move conflict warning to just-before success message This is a much better location for these errors, since they're in a much more visible spot. We've had reports in the past of users missing these messages, and changing where we present these warnings should help resolve that issue. We do lose the ability for an advanced user to potentially see the warning and abort installation before the conflicts are introduced, but given that we don't even pause for input, I don't think that's a strong argument and neither do I view this as necessary. --- src/pip/_internal/commands/install.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index 416e8be4220..c89f4836e20 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -373,13 +373,13 @@ def run(self, options, args): ) # Check for conflicts in the package set we're installing. + conflicts = None # type: Optional[ConflictDetails] should_warn_about_conflicts = ( not options.ignore_dependencies and options.warn_about_conflicts ) if should_warn_about_conflicts: conflicts = self._determine_conflicts(to_install) - self._warn_about_conflicts(conflicts) # Don't warn about script install locations if # --target has been specified @@ -421,6 +421,10 @@ def run(self, options, args): except Exception: pass items.append(item) + + if conflicts is not None: + self._warn_about_conflicts(conflicts) + installed_desc = ' '.join(items) if installed_desc: write_output(