Installing Python 2.5 on Ubuntu Linux 10.10

Hey there! I'm currently working on a CLI tool to deploy WordPress apps to DigitalOcean. Check it out! It's free and open source.

If you’ve been working on App Engine and you’ve noticed that some stuff works on your development server but not on your production, it may be related to the different versions of Python. Latest linux builds including Ubuntu 10.04 and 10.10 come with Python 2.6 pre-installed, but Google App Engine still runs Python 2.5 (an issue has been created to add Python 2.6 support, make sure you vote that up).

Their roadmap mentions nothing about upgrading. So in order to make your development server look more like your production servers, you’ll have to get Python 2.5, which is not that trivial at first.

So, Felix Krull has published an archive of new and old Python packages, so let’s use that source to get Python 2.5 running on a new Ubuntu box:

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.5

Yup, that was easy! Let’s now see if both Python 2.5 and Python 2.6 are available:

$ python2.5
Python 2.5.5 (r255:77872, Sep 14 2010, 15:51:01)

$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)

All done! Oh and don’t forget to launch your App Engine development server using python2.5 (installing it is not enough):

$ python2.5 .

As a bonus to this post, I’d like to share with you my way of working with App Engine, not in terms of code, but in terms of libraries organization. If you’re writing code for App Engine you’re probably working on more than one project at a time, hence you’ll need to use the SDK more than once.

So instead of copying it, replacing Python packages, etc, simply move the google_appengine folder to /usr/share and in every App Engine project create a symbolic link called .gae that points to that location. The SDK will automatically locate all the Google libraries and the development server is easy to launch:

$ ln -s /usr/share/google_appengine/ .gae
$ python2.5 .gae/ .

Don’t forget the dot at the end, since it tells the SDK which project to launch. And make sure you don’t push the .gae directory to your source control ;) Happy coding!

15 thoughts on “Installing Python 2.5 on Ubuntu Linux 10.10

  1. Tweets that mention Installing Python 2.5 on Ubuntu Linux 10.10 --

  2. sudo add-apt-repository ppa:fkrull/deadsnakes

    This line fails with the error
    gpg: requesting key DB82666C from hkp server
    ?: Connection timed out
    gpgkeys: HTTP fetch error 7: couldn't connect: Connection timed out
    gpg: no valid OpenPGP data found.
    gpg: Total number processed: 0

  3. "All done! Oh and don’t forget to launch your App Engine development server using python2.5 (installing it is not enough)"

    You can still use virtualenv to make this part easier ;)

  4. Thank You, Константин. I`ve put my ubuntu into the grave trying to install python2.5 for GAE. Next time i`ll hit my neck saying "Use Google, idiot!".
    i`ll put "+" to your carma.

  5. Hi
    Thanks for the tip. When I run dev_appserver with Python 2.5, I get a couple of warnings that do not come up if I run it with 2.6: 'No ssl package found…' and 'Could not initialize images API; you are likely missing the Python "PIL" module'

    (Does that mean I need to use 2.6 to use PIL?)

    Thanks for any thoughts

  6. Hi,

    I get this error –
    Reading package lists… Done
    W: GPG error: natty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B22AB97AF1CDFA9

    when i run sudo apt-get update

    Any suggestions?

    Thank you

Comments are closed.