Pip: Latest pip 8.1.2 fails to upgrade on Ubuntu 16.04

Created on 4 Jun 2016  ·  28Comments  ·  Source: pypa/pip

  • Pip version: 8.1.1
  • Python version: 3.5
  • Operating System: Ubuntu 16.04

    Description:

Tried to upgrade pip 8.1.1 to 8.1.2 for Python 3.5, downloaded the wheel for pip 8.1.2, but still displays version of pip as 8.1.1. This happens regardless of if I remove cache or used the cached wheel. Many others are having a similar problem: http://askubuntu.com/questions/775942/latest-python-pip-with-u16-04

What I've run:

$ python3.5 -m pip install --upgrade pip
Collecting pip
Using cached pip-8.1.2-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

auto-locked

Most helpful comment

It working:

wget https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz

tar -xzvf pip-8.1.2.tar.gz

cd pip-8.1.2

sudo python setup.py install

All 28 comments

Can you re-test this and paste the full commands you ran and their output, and why you think you don't have pip 8.1.2? I just tried running this command locally, and I got:

njs@a08469421425:~$ pip3 install -U pip
Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
    100% |################################| 1.2MB 787kB/s 
Installing collected packages: pip
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
njs@a08469421425:~$ pip3 install -U pip
Requirement already up-to-date: pip in ./.local/lib/python3.5/site-packages
njs@a08469421425:~$ pip3 --version
pip 8.1.2 from /home/njs/.local/lib/python3.5/site-packages (python 3.5)

So I got the same output, but pip was in fact upgraded to 8.1.2. (It's definitely a bug that it said "successfully installed pip-8.1.1" -- I have no idea what's up with that, someone who knows pip better than me might. And probably it should be considered a bug that after upgrading pip, pip complains about being an old version -- but this is just confusing, not actually a problem, what pip is saying is that the version of pip you're _running_ is 8.1.1, _not_ that the version of pip you just _installed_ is 8.1.1.)

Also, if I try using python 2.7's pip, like in the linked askubuntu question, I get:

njs@8bde0cc97ff7:~$ pip install --upgrade pip
Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
    100% |################################| 1.2MB 883kB/s 
Installing collected packages: pip
Successfully installed pip-8.1.2
njs@8bde0cc97ff7:~$ pip install --upgrade pip
Requirement already up-to-date: pip in ./.local/lib/python2.7/site-packages
njs@8bde0cc97ff7:~$ pip --version
pip 8.1.2 from /home/njs/.local/lib/python2.7/site-packages (python 2.7)

So not only does that work, but it also avoids the weird output issues I saw with the xenial pip3.

I think this is going to be because Ubuntu patches their pip to prevent it from modifying packages installed with apt.

@njsmith: I get the "You are using pip version 8.1.1, however version 8.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command." message for pip for both Python 2 (pip) and Python 3 (pip3). For Python 2, pip --version gives pip 8.1.2 from /home/edwinksl/.local/lib/python2.7/site-packages (python 2.7) and for Python 3, pip3 --version gives pip 8.1.2 from /home/edwinksl/.local/lib/python3.5/site-packages (python 3.5). Therefore, it does seem that pip has been successfully upgraded from 8.1.1 to 8.1.2 for both Pythons despite the (misleading) warning messages.

The issue here is I don't know if the bug with the erroneous warning messages lies with pip itself or with the Ubuntu patches for pip as suggested by @dstufft.

Oh right, it installing into --user, I forgot Ubuntu applied that patch, if you're still getting that error message, it might be because of wonky sys.path. What does python -c "import pip; print(pip.__version__)" give you?

@dstufft python -c "import pip; print(pip.__version__)" gives 8.1.2.

Interesting... and you're still getting that "you're using 8.1.1 but 8.1.2 is available" message?

@dstufft I only got that message on the first invocation of pip install -U pip for Python 2 and pip3 install -U pip for Python 3. Subsequent invocations gave Requirement already up-to-date: pip in ./.local/lib/python2.7/site-packages for Python 2 and Requirement already up-to-date: pip in ./.local/lib/python3.5/site-packages for Python 3.

Ah- Ok then I think that's just a bug that I think we have open somewhere else, where upgrading sometimes doesn't indicate the newest version until after the processes has completely exited.

@dstufft That makes sense to me, thanks!

Same thing here. python -c "import pip; print(pip.version)" reports "8.1.2", yet I still get the error. Unless it's because the command I need to run (STATIC_DEPS=true sudo -H pip install lxml==3.6.0) is calling it with sudo?

Just contributing to make some additional noise regarding this issue. The upgrade fails for me as well, additionally, uninstalling pip3 and reinstalling results in version 8.1.1, not 8.1.2.

does sudo -H pip install --upgrade pip work for anyone?

Not working on ubuntu 16.04

sudo -H pip install --upgrade pip
Collecting pip
  Using cached pip-8.1.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 8.1.1
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-8.1.1
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

It working:

wget https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz

tar -xzvf pip-8.1.2.tar.gz

cd pip-8.1.2

sudo python setup.py install

admed
thank you

As the real issue seems to be the old version reported when installing the new version, I'm closing this issue as duplicate of #3049, #2382 and #3709

Hi there! I had the same problem on Linux Mint 18, finally found the answer on pip's homepage! This method worked for me. Hope it helps!

You might have multiple Python Versions installed. I'm running Ubuntu 16.04 and finally figured that I needed to upgrade the pip in both python 2.7 and 3. Since I run them side by side, I needed to specify pip3

pip3 install -U pip

same issue on 'Ubuntu 16.04.1 LTS'. but following commands helps:

apt-get remove python3-pip python-pip
pip2 install -U pip
pip3 install -U pip

now it's ok:

# pip install --upgrade pip
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages
# python2 -c "import pip; print(pip.__version__)"
9.0.1
# python3 -c "import pip; print(pip.__version__)"
9.0.1

I was getting the same error of Certbot has problem setting up the virtual environment and You are using pip version 8.0.3, however version 9.0.1 is available when running certbot-auto via cron. Running certbot-auto regularly (as root) works fine. To solve this I had to add export HOME=/root to the start of the cron command, like this:

48 */11 * * * export HOME=/root; /root/bin/certbot-auto renew --quiet --no-self-upgrade

I removed first pip3 with:

sudo apt remove python3-pip

Then installed with:
python get-pip.py

Instructions can be found here:
https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py

Full process flow to install latest pip: (some steps may be redundant if you already have pip installed but no harm done)

sudo su                               # become root
cd                                    # prevent trashing your user's python cache permissions
apt-get install python3-pip           # bring in easy_install3
pip install --upgrade pip             # cache latest pip sources
apt-get remove python3-pip python-pip # remove Ubuntu's pip
easy_install3 pip                     # install up to date vanilla pip
pip --version                         # verify it
exit                                  # back to your user.

This works for me in Python 2.
sudo apt-get purge --auto-remove python-pip
Then follow steps by @sc00ut above.

This works for me too. Following the steps of @Dinh-Hung-Tu & @sc00ut
and the latest step is
hash -r
to refresh cache

apt update && upgrade python3-pip

thank you admen, it worked.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings