Manually Installing Pip and Wheel

Posted on Sat 27 September 2014 in Development Operations

I recently had an installation of Debian Wheezy on an an ARMv5 device that needed some new Python packages installed. Having performed some Python development in the past, I wanted to use [Pip]( (a Python package manager).

I also needed to install some Python Wheels. Wheels are an interesting addition to the Python lifecycle. Since the packages are already pre-built, there is no worry about the whole build phase when installing a Python package – a phase that could really cause you to have a bad day if you don’t have a good build environment already installed.

Unfortunately, sometimes installing packages isn’t as straightforward as I would hope it would be – sometimes it is on those good days when the stars are aligned correctly, and your lucky rabbit’s foot is tuned up. But other times, it requires a little bit of persistence and tweaking until you get it right.

Installing from Repos

At first, I installed Pip from the repositories. I ran a quick search to find the correct package:

sudo apt-cache search pip | grep python

Installation was via a typical apt-get command:

sudo apt-get install python-pip

Afterwards, I used Pip itself to install the required Wheel package:

sudo pip install wheel

As a test, I tried to install a recent setuptools wheel package into the current directory, but was met with an error message:

# pip wheel --wheel-dir=./ setuptools
pip: error: No command by the name pip wheel
  (maybe you meant "pip help --wheel-dir=./ setuptools")

A quick check on the version confirmed it:

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

The wheel command needs a much newer version of Pip. I did a quick apt-get update and checked the repos again:

sudo apt-get update
sudo apt-cache madison python-pip
python-pip |      1.1-3 | wheezy/main armel Packages

Nope, looks like version 1.1 is as good as it’s going to get from the repos. Time for plan B.

Manual Installation

To prevent problems with having multiple binaries, I purged the existing Pip binary:

# sudo apt-get purge python-pip
Reading package lists... Done
Building dependency tree        
Reading state information... Done
The following packages will be REMOVED:
0 upgraded, 0 newly installed, 1 to remove and 75 not upgraded.
After this operation, 468 kB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 30164 files and directories currently installed.)
Removing python-pip ...
Processing triggers for man-db ...

After reading the documentation, the simple way to install was to grab the Python script directly from Pip’s bootstrap site using wget. It requires an HTTPS connection however, so it helps to make sure you set the secure protocol switch:

# wget --secure-protocol=auto
--2014-09-26 23:56:33--
Resolving (
Connecting to (||:443... connected.
ERROR: The certificate of `' is not trusted.
ERROR: The certificate of `' hasn't got a known issuer.

Looks like my root certificates were out of date. The quickest fix (if you are really worried about ghosts, spiders, EMPs and security) was to update the ca-certificates package:

# sudo apt-get install ca-certificates
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 75 not upgraded.
Need to get 185 kB of archives.
After this operation, 337 kB of additional disk space will be used.
Get:1 wheezy/main ca-certificates all 20130119 [185 kB]
Fetched 185 kB in 0s (437 kB/s)     
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package ca-certificates.
(Reading database ... 29993 files and directories currently installed.)
Unpacking ca-certificates (from .../ca-certificates_20130119_all.deb) ...
Processing triggers for man-db ...
Setting up ca-certificates (20130119) ...
Processing triggers for ca-certificates ...
Updating certificates in /etc/ssl/certs... 158 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.

Sure enough, the wget worked without problems:

# wget --secure-protocol=auto
--2014-09-27 00:02:03--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1340903 (1.3M) [text/x-python]
Saving to: `'

100%[================================================================>] 1,340,903   1.46M/s   in 0.9s    

2014-09-27 00:02:08 (1.46 MB/s) - `' saved [1340903/1340903]

After that, I finally installed Pip using the Python script:

# sudo python ./
Downloading/unpacking pip
  Downloading pip-1.5.6-py2.py3-none-any.whl (1.0MB): 1.0MB downloaded
Installing collected packages: pip
Successfully installed pip
Cleaning up...

Okay, then I checked Pip’s version:

# pip --version
pip 1.5.6 from /usr/local/lib/python2.7/dist-packages (python 2.7)

Looks like Pip was ready to go. A quick test to install the setuptools wheel to the current directory:

# pip wheel --wheel-dir=./ setuptools
Downloading/unpacking setuptools
  Downloading setuptools-6.0-py2.py3-none-any.whl (533kB): 533kB downloaded
  Saved ./setuptools-6.0-py2.py3-none-any.whl
Cleaning up...

Now we’re cooking with gas!


Sometimes what should be simple package management turns out to be much more complicated. It pays to keep digging a little – usually the sources of the problems are due to outdated packages or unmet dependencies.