How to install the latest version of pip when I already installed the provided by Ubuntu?

Its not a good idea to update the system python unless you are actually working on ubuntu code and have a specific reason to. There are a lot of system dependencies you can break by updating with pip instead of using the python libs in the APT repository.

If you are developing python applications and need to change versions of libraries then you should use either a the --user options to pip or create a virtualenv to store your users versions of the libs.

Both of these methods will gracefully fall back to using system libs if they don't have their own copies, virtualenv has more options on how to control that feedback.

pip with --user

This is as easy as just adding --user to the end of all your pip commands, this will put your python libs in ~/.local/lib/pythonX.X (where X.X is your python version number) , they will be looked for here first just be careful about doing this for root if you have to run via sudo as it may effect the system python.

virtualenv

This works in a similar way to that above but is less tied to a specific user so doesn't have the sudo limitation, you can also clone a virtualenv and upgrade it to test changes thus allowing you to revert if it sucks. http://docs.python-guide.org/en/latest/dev/virtualenvs/


It seems like this might be a problem with installing the .whl file for pip 8.1.2. A work-around to install pip 8.1.2 is to download the source directly from PyPi and install it via setup.py.

The following worked for me:

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

This of course is not a solution to install pip 8.1.2 via pip install --upgrade, but should squelch the warning until this issue is resolved.


sudo -H python -m pip install --upgrade pip will solve your issue. As someone mentioned above though the system specific requires python 2.7 for certain things... That being said you can upgrade pip without negatively impacting that but you can also install 3.5 alongside if you want to.

the -H is a flag for sudo that requests that the security policy set the HOME environment variable to the home directory specified by the target user's password database entry. Depending on the policy, this may be the default behavior.