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

Comments

Projects
None yet
7 participants
@anentropic

anentropic commented Jan 29, 2015

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

This comment has been minimized.

Show comment
Hide comment
@anentropic

anentropic Jan 29, 2015

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

anentropic commented Jan 29, 2015

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

This comment has been minimized.

Show comment
Hide comment
@xavfernandez

xavfernandez Jan 29, 2015

Contributor

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.

Contributor

xavfernandez commented Jan 29, 2015

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

This comment has been minimized.

Show comment
Hide comment
@anentropic

anentropic Jan 29, 2015

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

anentropic commented Jan 29, 2015

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

This comment has been minimized.

Show comment
Hide comment
@rbtcollins

rbtcollins May 9, 2015

Contributor

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

Contributor

rbtcollins commented May 9, 2015

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

@cviner

This comment has been minimized.

Show comment
Hide comment
@cviner

cviner 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 

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

This comment has been minimized.

Show comment
Hide comment
@rbtcollins

rbtcollins Jun 9, 2015

Contributor

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

Contributor

rbtcollins commented Jun 9, 2015

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

@cviner

This comment has been minimized.

Show comment
Hide comment
@cviner

cviner 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).

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

This comment has been minimized.

Show comment
Hide comment
@rbtcollins

rbtcollins Jun 9, 2015

Contributor

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

Contributor

rbtcollins commented Jun 9, 2015

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

@cviner

This comment has been minimized.

Show comment
Hide comment
@cviner

cviner Jun 9, 2015

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

cviner commented Jun 9, 2015

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

@mjs

This comment has been minimized.

Show comment
Hide comment
@mjs

mjs 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)

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

This comment has been minimized.

Show comment
Hide comment
@zyv

zyv 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.

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

This comment has been minimized.

Show comment
Hide comment
@wm75

wm75 Apr 22, 2016

Contributor

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

Contributor

wm75 commented Apr 22, 2016

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

@xavfernandez

This comment has been minimized.

Show comment
Hide comment
@xavfernandez

xavfernandez Oct 27, 2016

Contributor

Hopefully fixed by #3723

Contributor

xavfernandez commented Oct 27, 2016

Hopefully fixed by #3723

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment