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

Incorrect command is shown to upgrade pip3 #7376

Closed
paszesoft opened this issue Nov 18, 2019 · 6 comments · Fixed by #7532
Closed

Incorrect command is shown to upgrade pip3 #7376

paszesoft opened this issue Nov 18, 2019 · 6 comments · Fixed by #7532

Comments

@paszesoft
Copy link

@paszesoft paszesoft commented Nov 18, 2019

macOS High Sierra Version 10.13.6 Terminal App

  • pip version: 19.2.3
  • Python version: 3.8
  • OS: High Sierra Version 10.13.6

Description
At Python 3.8 fresh (1st time - only Python 2 was present prior) install, as well as after pip3 list command, the following incorrect message is displayed:

WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Expected behavior
The correct message to be displayed should read:

WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip**3** install --upgrade pip' command.

(missing 3 after pip)

How to Reproduce

  1. Get package from https://www.python.org/ftp/python/3.8.0/python-3.8.0-macosx10.9.pkg

  2. Then run https://www.python.org/ftp/python/3.8.0/python-3.8.0-macosx10.9.pkg

  3. The warning is displayed:

    WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.`
    
  4. Then run pip install --upgrade pip as suggested by the warning.

  5. An error is displayed:

    Collecting pip3
      ERROR: Could not find a version that satisfies the requirement pip3 (from versions: none)
    ERROR: No matching distribution found for pip3
    
  6. Then run pip3 install --upgrade pip as suggested by me above.

  7. Successful installation should commence, e.g.:

    Collecting pip
      Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
         |████████████████████████████████| 1.4MB 3.4MB/s 
    Installing collected packages: pip
      Found existing installation: pip 19.2.3
        Uninstalling pip-19.2.3:
          Successfully uninstalled pip-19.2.3
    Successfully installed pip-19.3.1
    MM:~ username$ pip3 list
    Package    Version  
    ---------- ---------
    certifi    2019.9.11
    pip        19.3.1   
    setuptools 41.2.0
    
@triage-new-issues triage-new-issues bot added the triage label Nov 18, 2019
@paszesoft

This comment has been minimized.

Copy link
Author

@paszesoft paszesoft commented Nov 18, 2019

This issue seems to be lingering from previous versions, since I have not seen the correct resolution anywhere.

@uranusjr

This comment has been minimized.

Copy link
Member

@uranusjr uranusjr commented Nov 20, 2019

Right now it’s just hardcoded.

# Advise "python -m pip" on Windows to avoid issues
# with overwriting pip.exe.
if WINDOWS:
pip_cmd = "python -m pip"
else:
pip_cmd = "pip"
logger.warning(
"You are using pip version %s; however, version %s is "
"available.\nYou should consider upgrading via the "
"'%s install --upgrade pip' command.",
pip_version, pypi_version, pip_cmd
)

Maybe we can use sys.argv[0] instead? But then how should we handle python -m pip?

@chrahunt

This comment has been minimized.

Copy link
Member

@chrahunt chrahunt commented Nov 20, 2019

It would be kind of ugly, but we could unconditionally put {sys.executable} -m pip.

@uday-patel

This comment has been minimized.

Copy link

@uday-patel uday-patel commented Dec 27, 2019

pip3 install --upgrade pip
Thank you, the above worked

@vharsh

This comment has been minimized.

Copy link
Contributor

@vharsh vharsh commented Dec 31, 2019

A recent version of a windows system will have a binary akin to the which of a UNIX system, maybe we can say, $(which python) install --upgrade pip and $(where python) --upgrade pip, but this is sort of not so useful. If pip is working fine, that means python? is in $PATH or %PATH% for sure.

But to solve the 2 or 3 problem, we might want to suffix the major version from sys.version_info to pip_cmd.

Ref: https://stackoverflow.com/questions/304319/is-there-an-equivalent-of-which-on-the-windows-command-line

@uranusjr

This comment has been minimized.

Copy link
Member

@uranusjr uranusjr commented Dec 31, 2019

If pip is working fine, that means python? is in $PATH or %PATH% for sure.

This is most definitely not true. There is close to no guarantee what Python is available (or any at all) when pip is invoked. I agree with @chrahunt on unconditionally showing sys.executable; it is really the most reliable thing we can use here.

@lock lock bot added the S: auto-locked label Feb 6, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Feb 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants
You can’t perform that action at this time.