3
  • Ubuntu 12.04
  • Python 2.7
  • apt 0.8.16~exp12ubuntu10.17 for amd64 compiled on Jun 13 2014 17:42:13

When I run sudo apt-get install python-pip It installs a a very old version.

$ pip --version
pip 1.0 from /usr/lib/python2.7/dist-packages (python 2.7)

This has caused me all sorts of problems as that version of pip has trouble locating many packages.

When I try to install the latest version 1.5.6 via apt-get It wont locate it.

[$ sudo apt-get install python-pip=1.5.6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '1.5.6' for 'python-pip' was not found][2]

NOTE: I have previously run apt-get update and apt-get update

When I try to install pip by executing sudo python get-pip.py I get

$ python get-pip.py
Downloading/unpacking pip
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement pip
Cleaning up...
No distributions at all found for pip
Storing debug log for failure in /home/user/.pip/pip.log 

I believe this is because of some issues with the Ubuntu VM proxy settings which I can get resolved later in the week.

Preferably I just want to install a recent version of pip via apt-get but I am open to any solution.

Any help is much appreciated

Kristopher Ives
  • 5,419
  • 2
  • 27
  • 36
Deepend
  • 153
  • 2
  • 2
  • 8

2 Answers2

4
sudo apt-get install --reinstall python2.7
sudo apt-get purge python-pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py
sudo pip install package-name

This works perfectly in Ubuntu 14.04,check in 12.04 otherwise upgrade the version and follow above steps.

Sivagami Nambi
  • 221
  • 1
  • 6
  • These instructions worked for me to install Flask on 12.04.5 LTS, with the following changes: 0) Installed `software-properties-common` and `python-software-properties` to add a new PPA; 1) Switched python2.7 to the "deadsnakes" PPA, [per this Superuser post](https://superuser.com/a/942296/582181); 2) Ran the `apt-get purge` command for pip and Flask first, then rebooted; 3) Then, I followed the above instructions, and I was able to run Flask [per this Flask quickstart guide](https://flask.palletsprojects.com/en/1.1.x/quickstart/#about-responses). – Rocky Raccoon Aug 28 '20 at 00:09
0

Ubuntu official repositories don't have that new a version of pip for 12.04. And I couldn't find any PPAs. So apt-get won't be of much help. I think one way may be to install whatever version of pip is avalanche in the repositories and do sudo pip install -U pip - but this too will be affected by the proxy issue. One way out - upgrade to 14.04.

muru
  • 193,181
  • 53
  • 473
  • 722
  • I have tried the 'sudo pip install -U pip' option already but as you summarised it was not possible due to the proxy issue. I have no control over the version of Ubunto being used unfortunately – Deepend Jun 22 '14 at 19:01
  • @Deepend how is proxy configured in your system? Are the `http_proxy` and `https_proxy` variables set properly? Are special characters URL-encoded? – muru Jun 23 '14 at 06:01