Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change when we warn about dependency conflicts during pip install #8590

Merged
merged 5 commits into from
Jul 17, 2020

Conversation

pradyunsg
Copy link
Member

Toward #8546

This changes the location of the warnings about installation conflicts.

Before:

$ pip install flake8-import-order==0.17.1 flake8==3.5.0                            
Collecting flake8-import-order==0.17.1
  Using cached flake8_import_order-0.17.1-py2.py3-none-any.whl (17 kB)
Collecting flake8==3.5.0
  Using cached flake8-3.5.0-py2.py3-none-any.whl (69 kB)
Requirement already satisfied: setuptools in /Users/pradyunsg/.virtualenvs/tmp-dc0525085a0c2c3/lib/python3.8/site-packages (from flake8-import-order==0.17.1) (46.1.3)
Collecting pycodestyle
  Using cached pycodestyle-2.6.0-py2.py3-none-any.whl (41 kB)
Collecting pyflakes<1.7.0,>=1.5.0
  Using cached pyflakes-1.6.0-py2.py3-none-any.whl (227 kB)
Collecting mccabe<0.7.0,>=0.6.0
  Using cached mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
ERROR: flake8 3.5.0 has requirement pycodestyle<2.4.0,>=2.0.0, but you'll have pycodestyle 2.6.0 which is incompatible.
Installing collected packages: pycodestyle, flake8-import-order, pyflakes, mccabe, flake8
Successfully installed flake8-3.5.0 flake8-import-order-0.17.1 mccabe-0.6.1 pycodestyle-2.6.0 pyflakes-1.6.0

After

$ pip install flake8-import-order==0.17.1 flake8==3.5.0                            
Collecting flake8-import-order==0.17.1
  Using cached flake8_import_order-0.17.1-py2.py3-none-any.whl (17 kB)
Collecting flake8==3.5.0
  Using cached flake8-3.5.0-py2.py3-none-any.whl (69 kB)
Collecting pycodestyle
  Using cached pycodestyle-2.6.0-py2.py3-none-any.whl (41 kB)
Requirement already satisfied: setuptools in /Users/pradyunsg/.virtualenvs/tmp-dc0525085a0c2c3/lib/python3.8/site-packages (from flake8-import-order==0.17.1) (46.1.3)
Collecting pyflakes<1.7.0,>=1.5.0
  Using cached pyflakes-1.6.0-py2.py3-none-any.whl (227 kB)
Collecting mccabe<0.7.0,>=0.6.0
  Using cached mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Installing collected packages: pycodestyle, flake8-import-order, pyflakes, mccabe, flake8
ERROR: flake8 3.5.0 has requirement pycodestyle<2.4.0,>=2.0.0, but you'll have pycodestyle 2.6.0 which is incompatible.
Successfully installed flake8-3.5.0 flake8-import-order-0.17.1 mccabe-0.6.1 pycodestyle-2.6.0 pyflakes-1.6.0

The change in position of the ERROR line is the main change in this PR. The reason I want to make this change, is to better position this error when the "Installing collected packages" step produces a lot of output (eg: setup.py install runs, wheel builds etc).

Making this into two functions allows for separating the "check"
and "print warnings" step in a follow up commit.
The duplication of this code isn't really that bad, but saying
"pip check" makes it ambigous which file is relevant. Changing to
reference the exact filename makes this clearer.
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.
@pradyunsg pradyunsg added the skip news Does not need a NEWS file entry (eg: trivial changes) label Jul 16, 2020
src/pip/_internal/commands/install.py Outdated Show resolved Hide resolved
@pradyunsg pradyunsg merged commit 2a07a24 into pypa:master Jul 17, 2020
@pradyunsg pradyunsg deleted the install-conflict-warning-move branch July 17, 2020 00:18
@pradyunsg
Copy link
Member Author

Thanks for the review @chrahunt! ^>^

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants