Installation of Python 2.5 and Google App Engine in Ubuntu 11.04

If you are planning run Google App Engine Server inside your Ubuntu, It can be a lot of pain in the ass. After tons of searches on Stack Overflow, I didn’t get the proper solution which I wanted. There are different ways to install App Engine Server in your Ubuntu Machine. But most important part is installation of Python 2.5 in the machine and that is the most intricate part. Now I will show you why you need Python 2.5, how to install it and so on….

STEP 1: (Python 2.5 Installation)

Even before starting your App Engine Server there is one important dependency you need to look. i.e. Python 2.5. Google App Engine SDK is compatible with Python 2.5 only. However Ubuntu 11.04 comes with Python 2.7, if you have tried then you will find that Server can run under Python 2.7 environment too. But as the project becomes more complex you will need Python 2.5 otherwise for ‘Hello World’ projects it’s not necessary to have Python 2.5 (according to my experience).

If you are planning to do some ‘sudo apt-get install python2.5’, It won’t work. As Python 2.5 is not present in the latest Ubuntu Repos. It has been removed after release of Ubuntu 9.10.

You can install Python 2.5 by downloading the source code from its website but it does not work for App Engine even though Python 2.5 is present in your machine it will give you error about AttributeError: ‘module’ object has no attribute ‘HTTPSHandler’ . So better solution for that is given by a guy called Felix Krull. He has published newer and older versions of python as PPA. Trust me at one point even I refused to install Thrid Party PPA but I had no other choice. Here are some commands:

sudo add-apt-repository ppa:fkrull/deadsnakes

sudo apt-get update

sudo apt-get install python2.5

Thats it! Now you have Python 2.5 in your machine. You can check it out by running:


But however your default python is still python2.7 (run python -V). (If not then read Step 2)

[EDIT] In my earlier post following method was used to replace default python with python2.5 as AppEngine needs Python2.5 as I mentioned earlier. But this may further lead to Broken Applications, ie applications like Software Center, Gwibber, Unity Dash which are dependent on Python2.7 will not work as you have replaced default python with 2.5. So you are supposed to move directly to ‘installation of Google App Engine Step’. However if you want to play with Ubuntu you can view it.

You need to replace that with python2.5. It can be done by creating a new Symbolic Link:

sudo rm /usr/bin/python

sudo ln -s /usr/bin/python2.5 /usr/bin/python

Now you have python2.5 as default python. (Confirm it by python -V)

STEP 2: (Installation of Google App Engine)

This one is the most simplest thing. All you need to do is Download Google Appengine Python SDK extract it where ever you want you will get a directory called ‘google_appengine’. Get the path for ‘google_appengine’ and then run:

$ [path will be here]/google_appengine/

You should get a list of all ‘Options’ if you are getting it means App Engine is successfully installed.

Now let us move back to ‘Python2.5’. Even though Python2.5 is installed in your machine AppEngine is not actually using it. As it uses default Python (ie 2.7 in this case). If you are creating simple applications e.g. ‘Hello World’ then App Engine will work but as your application becomes complex App Engine will break as it does not support Python2.7. So to use Python2.5 by AppEngine you have to open file in any Editor which will have first line as #!/usr/bin/env python all you have to do is replace it with #!/usr/bin/env python2.5. This will tell AppEngine to use python2.5 as startup environment.

However you will be working with more projects so everytime running

$ [path will be here]/google_appengine/ [path for the project]

will be time-consuming so this problem can be solved by setting up environment variables.

In this case you need to edit .bashrc file present inside Home Directory (It will be hidden). Run

$vim .bashrc


gedit .bashrc

And at the end put ‘export PATH=$PATH:[Your path to]/google_appengine/’. Save it and then confirm it by running ‘echo $PATH’ if you get ‘google_appengine’ path in the end means it has been successfully done. Now instead of running

$ [path will be here]/google_appengine/ [path for the project]

all you have to do is run :

$ [path for the project]

Installation of Grub after Windows Installation in Ubuntu 10.04

We all know that, in a machine which is a dual boot (one which has more than one Operating System) its important to have Grub Loader (especially when you have Linux based distro) as Grub is responsible for Switching between the OS. When you have Linux based distro already in your PC but for some reason you also install Windows or Update to Newer Version or Reinstall Windows, it happens that Windows REPLACES Grub Loader from your machine and puts Windows Boot Loader due to which you can’t switch to any of the other Linux based distros. Hence its important to know how to re-install Grub Loader rather than re-installing the distro itself.

Earlier Methods:

In the earlier methods i.e. before Ubuntu 9.10 there was Grub 0.97, but after Ubuntu 9.10 they introduced Grub 1.96.
In the earlier versions it was quite easy to install Grub Loader as you have to type commands such as ‘sudo grub’ which used to take you to grub prompt. Where by giving ‘find /boot/grub/stage1’ you used to give location where exactly grub loader was located and then by ‘root (hd_,1)’ and ‘setup(hd_)’ you were able to get back Grub Loader.
But in Grub 1.97 the method is changed. I tried to find out ‘menu.lst’ and ‘stage1’ files in grub folder but I found that these files are removed and replaced by ‘grub.cfg’. In fact if you run ‘sudo grub’ in any live CD it gives error as ‘Command not Found’, then i tried it by installing via ‘sudo grub-install’ and tried replacing ‘stage1’ by ‘grub.cfg’ ie ‘find /boot/grub/grub.cfg’ but it was not working out. There is a little different way of installing Grub 1.97 in your machine.

Grub 1.97 Installation
If you tried above method then it is recommended to Reboot your machine. And follow the steps given below:-
  1. Boot from Live CD (Ubuntu 9.10 or above)
  2. Mount the partition which has ‘Ubuntu Installation’. (Note that it is ‘/’) And once mounted you should see ‘boot’ folder in it.
  3. Get the UUID of the partition. You can get the UUID from ‘/media’. In my case its shown in the image. (You better go to Properties of the partition by right clicking on the partition and then Copy it)
  4. And then open ‘Terminal’ from ‘Applications -> Accessories’.
  5. Then type
    sudo grub-setup -d /media/UUID/boot/grub /dev/sda
  6. Replace UUID with your UUID.
  7. In the above case ‘sda’ and ‘sdb’ will be dependent on where MBR is installed in most of the cases its in ‘sda’.
  8. Reboot it.
  9. BANG!! You will get those OS options again.