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

pip install --upgrade reports wrong version on success #2382

Closed
anentropic opened this issue Jan 29, 2015 · 13 comments
Closed

pip install --upgrade reports wrong version on success #2382

anentropic opened this issue Jan 29, 2015 · 13 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@anentropic
Copy link

When upgrading, pip reports that it "Successfully installed" the version it just upgraded from.

Actual upgrade seems to have succeeded, it's just the success message is wrong.

$ pip install --upgrade pip
Collecting pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-6.0.7-py2.py3-none-any.whl#md5=9a7ea5d89062613887b75e01e5d82c36
  Using cached pip-6.0.7-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 6.0.6
    Uninstalling pip-6.0.6:
      Successfully uninstalled pip-6.0.6

Successfully installed pip-6.0.6
$ pip --version
pip 6.0.7 from /usr/local/lib/python2.7/site-packages (python 2.7)
@anentropic
Copy link
Author

Only happens when "Using cached" i.e. second time you upgrade... initial install reports correctly:

$ pip install --upgrade pip
You are using pip version 6.0.6, however version 6.0.7 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-6.0.7-py2.py3-none-any.whl#md5=9a7ea5d89062613887b75e01e5d82c36
  Downloading pip-6.0.7-py2.py3-none-any.whl (1.3MB)
    100% |################################| 1.3MB 1.5MB/s
Installing collected packages: pip
  Found existing installation: pip 6.0.6
    Uninstalling pip-6.0.6:
      Successfully uninstalled pip-6.0.6

Successfully installed pip-6.0.7

@xavfernandez
Copy link
Member

It doesn't seem to come from "Using cached":

(test)xfernandez@xfernandez-PORTEGE-R930:~/other_dev/pip⟫ pip --version
pip 6.0.6 from /home/xfernandez/.virtualenvs/test/local/lib/python2.7/site-packages (python 2.7)
(test)xfernandez@xfernandez-PORTEGE-R930:~/other_dev/pip⟫ pip install --upgrade pip
You are using pip version 6.0.6, however version 6.0.7 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-6.0.7-py2.py3-none-any.whl#md5=9a7ea5d89062613887b75e01e5d82c36
  Using cached pip-6.0.7-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 6.0.6
    Uninstalling pip-6.0.6:
      Successfully uninstalled pip-6.0.6

Successfully installed pip-6.0.7

What is strange is that your first report finds a 6.0.6 installed pip but does not show the "You are using pip version 6.0.6, however version 6.0.7 is available." message.

@anentropic
Copy link
Author

My scenario was... first upgrade was inside an existing virtualenv.

Then I upgraded the system pip, which is where it used the cached download and reported wrong version.

So possibly problem is virtualenv related

@rbtcollins
Copy link

I believe i saw this recently in my dev environment, pkg_resources.WorkingSet() was returning cached data even for a new instance.

@cviner
Copy link

cviner commented Jun 9, 2015

I also appear to be encountering this issue in a Travis CI instance, but interestingly only when I use --user (i.e. sudo -H pip install --upgrade pip works as expected). In this instance, it does not appear to be the case that only the message is wrong, but rather pip itself operates as if it has really not been upgraded.
A partial record of pip commands and their output follows:

$ pip install --user --upgrade pip
You are using pip version 6.0.7, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-7.0.3-py2.py3-none-any.whl#md5=6950e1d775fea7ea50af690f72589dbd
  Downloading pip-7.0.3-py2.py3-none-any.whl (1.1MB)
    100% |################################| 1.1MB 338kB/s 
Installing collected packages: pip
Successfully installed pip-6.0.7
install.4
$ cat tests/requirements.txt | xargs -n 1 pip install --user --upgrade
You are using pip version 6.0.7, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting cython
  Downloading cython-0.22.tar.gz (1.6MB)
    100% |################################| 1.6MB 224kB/s 

@rbtcollins
Copy link

@cviner thats very different - its just that your PYTHONPATH doesn't pickup the newly installed pip.

@cviner
Copy link

cviner commented Jun 9, 2015

That was my initial suspicion, but it doesn't seem to account for the concluding message of the pip install --user --upgrade pip command: Successfully installed pip-6.0.7. Unless that message is actually checking the pip version itself and therefore running into the issue you described. However, I would expect pip to be able to upgrade itself in user mode and report the correct upgraded version upon completion (even if a subsequent pip command does not use the upgraded pip without my manually setting PYTHONPATH).

@rbtcollins
Copy link

Oh! I see. well, worth a closer look.

@cviner
Copy link

cviner commented Jun 9, 2015

@rbtcollins glad you agree and thanks for the prompt feedback!

@mjs
Copy link

mjs commented Sep 6, 2015

It seems that this problem is caused when the upgraded version of the package goes to a different directory than the version being upgraded. I can reliably trigger the bug by upgrading a globally installed package using --user.

Here's a detailed example:

# Make sure the user site is preferred 
$ export PATH=~/.local/bin:$PATH
$ export PYTHONPATH=~/.local/lib/python2.7/site-packages:$PYTHONPATH

# Avoid confusion when new pip binary appears in earlier in $PATH
$ shopt -s checkhash

# Using the globally installed pip...
$ type pip
pip is /usr/local/bin/pip
$ pip --version
pip 6.0.6 from /usr/local/lib/python2.7/dist-packages (python 2.7)

# Upgrade pip using --user - globally installed version number is incorrectly shown as being installed.
$ pip install --upgrade --user pip
Collecting pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-7.1.2-py2.py3-none-any.whl#md5=5ff9fec0be479e4e36df467556deed4d
  Using cached pip-7.1.2-py2.py3-none-any.whl
Installing collected packages: pip

Successfully installed pip-6.0.6

# But the correct version is actually installed...
$ type pip
pip is /home/menno/.local/bin/pip
$ pip --version
pip 7.1.2 from /home/menno/.local/lib/python2.7/site-packages (python 2.7)

@zyv
Copy link

zyv commented Apr 19, 2016

Same problem here with pip 8.1.1 (python 2.7):

$ python-dbg -m pip install --ignore-installed --prefix lib/python-dbg cython==0.23.4
Collecting cython==0.23.4
Installing collected packages: cython
Successfully installed cython-0.20.1.post0

The cython-0.20.1.post0 version is the one provided by the system Cython package. To reproduce, run apt-get install python-pip cython on stock Ubuntu 14.04, then upgrade to the latest pip with pip install -U --user pip wheel and try to install Cython in a prefix as shown above.

@wm75
Copy link

wm75 commented Apr 22, 2016

see pull request #3612 (migrated to master branch as #3723) which I think should fix this

@xavfernandez
Copy link
Member

Hopefully fixed by #3723

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

7 participants