Skip to content

Installing Python 3.4 and IPython on Debian Wheezy

This is the type of thing that’s easy when you know how. I couldn’t find any method of doing this that didn’t involve downloading source and compiling manually, which means Python 3.4 would be outside the package system and not receive automatic updates. However there is a method for completing this using aptitude in several steps. You will need to perform all these commands using root privileges.

First, add the sid unstable repo to your /etc/apt/sources.list:

deb http://ftp.debian.org/debian sid main

Next, you must set up apt-pinning. Otherwise your stable packages will be overwritten by the unstable versions next time you apt-get upgrade. Create or edit your /etc/apt/preferences file to look like this:

Package: *
Pin: release a=stable
Pin-Priority: 700

Package: *
Pin: release a=testing
Pin-Priority: 650

Package: *
Pin: release a=unstable
Pin-Priority: 600

This effectively says that stable packages have priority over testing, which have priority over unstable.

After that, do an

apt-update

which will pull in the package information from the unstable repo.

Next, it’s as easy as

aptitude install python3.4 python3.4-dev

That will install Python 3.4, but you still need to do a little leg work to get everything working. Python 3.4 comes with pip installed, which is great, but it might not get installed with the package. Definitely DON’T try to install it using aptitude. Instead, try this:

python -m ensurepip

Python 3.4 will set pip3.4 up correctly. However, due to the unstable nature of the python3.4 package, you will need to install some missing dependencies in order to get pip3.4 to work. No worries, you can still use easy_install-3.4 to do this:

easy_install-3.4 colorama
easy_install-3.4 distlib
easy_install-3.4 requests==2.1
easy_install-3.4 six
easy_install-3.4 html5lib

Finally we have a working Python 3.4 base install. Now all that’s left to do is install IPython:

pip3.4 install ipython

That’s it! Of course, this is really a setup for someone who wants to hack around on Python 3.4 in Debian, and shouldn’t be used in a production environment. Hope this helps someone out!

Published inDevelopment

Be First to Comment

Leave a Reply