Manually Installing Pip and Wheel

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

Hmm… 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 | http://cdn.debian.net/debian/ 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:
  python-pip*
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 get-pip.py 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 https://bootstrap.pypa.io/get-pip.py --secure-protocol=auto
--2014-09-26 23:56:33--  https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 199.27.79.175
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|199.27.79.175|:443... connected.
ERROR: The certificate of `bootstrap.pypa.io' is not trusted.
ERROR: The certificate of `bootstrap.pypa.io' 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:
  ca-certificates
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 http://cdn.debian.net/debian/ 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 https://bootstrap.pypa.io/get-pip.py --secure-protocol=auto
--2014-09-27 00:02:03--  https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 23.235.47.175
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|23.235.47.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1340903 (1.3M) [text/x-python]
Saving to: `get-pip.py'
 
100%[================================================================>] 1,340,903   1.46M/s   in 0.9s    
 
2014-09-27 00:02:08 (1.46 MB/s) - `get-pip.py' saved [1340903/1340903]

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

sudo python ./get-pip.py
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!

Summary

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.

Deer Detection Diversion 3 – Wildlife!

I’ve been taking pictures for several weeks for my Deer Detector, to keep track of murderous deer. While I haven’t seen as many as I thought I would, I did see a lot of other animals. So, without further delay, here are some of the wildlife photos from the yard!

Advertisements

The Main Event – Murderous Deer

First of all, here is some proof that those deer actually exist:

2014-08-28_04:31:31.827161

2014-08-28_04:31:43.465553

2014-08-28_04:32:21.695253

2014-08-28_04:35:33.846063

Our deer fence is enough to keep them out. They typically brush their noses against it, and then get discouraged.

2014-09-11_02:01:45.990664

One night, I was awakened by a thumping sound from the backyard. I had a flashlight nearby and spotted two bucks banging their heads together! What a racket at 3:00 in the morning! Definitely don’t want to get too close to these guys at this time of year!

2014-09-11_03:17:41.936455

2014-09-11_03:20:52.762180

2014-09-11_03:20:58.080957

2014-09-11_03:21:03.399594

2014-09-11_03:21:54.265104

Early one morning, one of the deer decided to plunk down for a little nap in the backyard. I think it was just standing guard while the other one tried to pick our lock at the front door (note the camera change to a different window – the bottom left hand corner is the towel I use to cut down on the glare in the window… I eventually fixed that).

2014-09-21 06:57:46.635809

2014-09-21 06:58:29.614825

2014-09-21 06:58:51.319149

The deer sat there for about 40 minutes until something spooked it off.

Sneaky Raccoons

There are also a large number of raccoons that travel through the yard each night. They come in various sizes, so I think there are a number of different families that visit the yard throughout the week.

2014-08-23_20:20:05.127577

2014-08-23_20:19:24.450193

2014-08-11_07-08-32

They really, really, really like eating our blackberries! Can’t say I blame them, they are delicious!

2014-08-23_20:19:18.441635

2014-08-23_20:18:49.305317

2014-08-23_20:18:43.468452

2014-08-11_07-14-37

The Raspberry Pi NOIR camera also catches them at night. They usually appear around dawn or dusk, but sometimes will be active at 3:00 am.

2014-08-27_04:51:54.127155

They also like climbing our apple tree, below you can see a small guy about to climb the tree. They will sometimes pull apples off of the tree (although the deer perform that trick more often – they usually take a bite out of an apple, spit it out, and then grab a fresh one… strictly one bite per apple… grrr… wasteful!).

2014-08-27_04:56:12.102134

 Cool Cats

There are several neighbourhood cats who have established some form of highway on our lawn as well.

2014-09-13_06:51:05.076771

2014-08-30_07:09:04.527430 2014-08-26_20:02:24.427480

2014-08-12_13-42-40

2014-09-14_13:09:56.127629

I’m not sure what the one below was staring at – it is looking right at our back door where the basement exit is. That cat sat there for about 5 minutes just looking at the door. Waiting for Basement Cat perhaps?

2014-09-14_08:23:55.647782

Wrapping Up

That’s just a small sample of some of the wildlife in the backyard. We’ve also seen birds, and the occasional dog as well. Tune in next time when I’ll try using color vision to detect raccoons, and hopefully use the neural network to start detecting deer!