Upgrade pip using pip.exe raises an error if the requirement already satisfied · Issue #6924 · pypa/pip (original) (raw)

Environment

Description

Currently modifying pip on Windows using pip.exe raises an error and suggests to upgrade it using module invocation python -m pip install ...:

ERROR: To modify pip, please run the following command:
C:\Python36\python.exe -m pip install --upgrade pip

But if the requirement is already satisfied or up-to-date it still raises the same error:

Requirement already satisfied: pip in c:\python36\lib\site-packages (19.3.dev0)
ERROR: To modify pip, please run the following command:
C:\Python36\python.exe -m pip install pip

Expected behavior

The command shouldn't raise the error if the requirement is up-to-date:

> pip install pip
Requirement already satisfied: pip in c:\python36\lib\site-packages (19.3.dev0)

How to Reproduce

  1. Get package from git+git://github.com/pypa/pip@d2b708#egg=pip
  2. Then run pip install pip
  3. An error occurs.

Output

> python -m pip install --upgrade git+git://github.com/pypa/pip@master#egg=pip==19.3.dev0
Collecting pip==19.3.dev0 from git+git://github.com/pypa/pip@master#egg=pip==19.3.dev0
  Cloning git://github.com/pypa/pip (to revision master) to c:\users\appveyor\appdata\local\temp\1\pip-install-t406pky0\pip
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
  Running setup.py install for pip: started
    Running setup.py install for pip: finished with status 'done'
Successfully installed pip-19.3.dev0

> pip install pip
Requirement already satisfied: pip in c:\python36\lib\site-packages (19.3.dev0)
ERROR: To modify pip, please run the following command:
C:\Python36\python.exe -m pip install pip

Additional context

This issue came out of the discussion in PR #6864 (comment).