Skip to main content

Install AppEngine Python SDK on Ubuntu 10.10

AppEngine is still stuck on python2.5, but recent Ubuntu distros don't even have the python2.5 package available anymore, which makes getting AppEngine up and running a bit cumbersome. There is a third-party package available, but I like knowing the contents of what I'm installing. Here are the steps to install python2.5 on Ubuntu 10.10 without overwriting the existing python installation. This worked for me, but no guarantees it will work on your system. It's a good idea to try it first in a virtual machine to make sure it'll work. You can install VMWare Player for free from http://www.vmware.com.

This is mostly based on http://code.google.com/p/googleappengine/issues/detail?id=757#c51, but fixes some problems in that post.

1. Install some necessary libraries:

> sudo apt-get install libssl-dev           
> sudo apt-get install libjpeg62-dev        
> sudo apt-get install libfreetype6-dev     
> sudo apt-get install libsqlite3-dev       

2. Install the latest openssl from http://www.openssl.org/. Just click on the "Source" tab, and then get the LATEST. Currently this is http://www.openssl.org/source/openssl-1.0.0a.tar.gz. Save it as a file rather than opening with the Archive Manager.

Then:

> tar -xzvf openssl-1.0.0.a.tar.gz          
> cd openssl-1.0.0.a                        
> ./config                                  
> make                                      
> sudo make install                         

This installs stuff at /usr/local/ssl/ (header files, etc).

3. Install the latest sqlite from http://sqlite.org/. Currently, this is http://sqlite.org/sqlite-amalgamation-3.7.3.tar.gz.

> tar -xzvf sqlite-amalgamation-3.7.3.tar.gz
> cd sqlite-3.7.3                           
> ./configure                               
> make                                      
> sudo make install                         

4. Install python2.5 from source. Download at http://www.python.org/download/releases/2.5.5/.

> tar -xzvf Python-2.5.5.tgz                
> cd Python-2.5.5                           

Change Modules/Setup.dist: (just need to uncomment the following lines: 202, 206-209). It should look like this afterwards:

202: _socket socketmodule.c
203:
204: # Socket module helper for SSL support; ...
205: # socket line above, ...
206: SSL=/usr/local/ssl
207: _ssl _ssl.c \
208:    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
209:    -L$(SSL)/lib -lssl -lcrypto

Then, you need to copy this setup file and do the install:

> cp Modules/Setup.dist Modules/Setup                                               
> ./configure                               
> make                                      
> sudo make altinstall                      

The altinstall (instead of plain "install") is important, because it will install it alongside the existing python distro (currently 2.6) instead of overwriting it. This means that when you run python, it will run 2.6, but you can explicitly use 2.5 by running python2.5.

5. Install Python Imaging Library. Download from http://www.pythonware.com/products/pil/. Latest version is currently at http://effbot.org/downloads/Imaging-1.1.7.tar.gz.

> tar -xzvf Imaging-1.1.7.tar.gz            
> cd Imaging-1.1.7                          
> sudo python2.5 setup.py install           

6. Finally, download and install Google AppEngine Python SDK from http://code.google.com/appengine/downloads.html#Google_App_Engine_SDK_for_Python.

Your system should now look like this:

> python --version          
Python 2.6.6                                                                        
> python2.5 --version       
Python 2.5.5                              

And when you run dev_appserver.py, explicitly start it via python2.5, like:

> python2.5 google_appengine/dev_appserver.py helloworld/     

Alternatively, you can change the first line of dev_appserver.py to read:

#!/usr/bin/env python2.5

instead of

#!/usr/bin/env python

You should now be able to run the entire Hello World python app described in the Getting Started tutorial at http://code.google.com/appengine/docs/python/gettingstarted/.

Enjoy!

Update: (May 13, 2012): Apparently there's an updated version here. I haven't checked it yet, but good luck! http://terse-words.blogspot.co.uk/2012/05/install-google-app-engine-on-ubuntu.html

Comments

  1. HI Darren, was very happy to find this page, which is well laid out. Good info. So followed steps. Now I am getting the following error: Python2.5 google_appengine/dev_appserver.py helloworld/
    Segmentation fault

    Any ideas what this is about? How to fix it?
    Or have I done something wrong??
    MJ

    ReplyDelete
  2. Yes, one of the required libraries is probably not installed. Can you run "strace python2.5 google_appengine/dev_appserver.py helloworld/" and display the output? It should show you where exactly it is breaking.

    ReplyDelete
  3. So I have run the same command using STRACE and in the output I can see the following:
    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
    open("/lib/libcrypto.so.0.9.8", O_RDONLY) = 7

    So I have looked in the etc library and that is indeed the case!
    So I have found the following link
    http://manpages.ubuntu.com/manpages/maverick/man8/ld.so.8.html
    Then I downloaded and gunzipped ld.so.8.gz
    So is that what I am supposed to use as the nowhcap file?
    Not sure what I should do next? New to Ubuntu/Linux, etc. Can you please advise?
    Thanks a mill

    ReplyDelete
  4. Seems like maybe openssl is not installed properly, since it's failing trying to access libcrypto.

    ReplyDelete
  5. Anonymous8:25 AM

    Thanks

    ReplyDelete
  6. There's an up to date version here - http://terse-words.blogspot.co.uk/2012/05/install-google-app-engine-on-ubuntu.html

    ReplyDelete

Post a Comment

Popular posts from this blog

English Lesson: "한국에 오신지 얼마나 됐어요?"라고 영어로?

I've lost count of how many times Koreans have asked me the question, "How long do you stay in Korea?" in those words or something very similar. Clearly this question is taught in every English class in Korea, because I hear it over and over again, so I just wanted to be very clear about something here:

DO NOT USE THIS EXPRESSION. IT IS INCORRECT.

This phrase is incorrect for a few reasons, but primarily because it sounds ambiguous to native English speakers. Specifically, there are probably two different questions that you really want to ask:

1) How long have you been in Korea? (한국에 오신지 얼마나 됐어요?)
2) How long will you stay in Korea? (한국에 얼마나 있을 거예요?/한국에 얼마동안 있을 계획이에요?)

Nearly always the intended question is number 1, "How long have you been in Korea?", followed afterwards by number 2, "How long will you stay in Korea?". But the incorrectly stated question ambiguously sounds somewhere in between number 1 and number 2. So, don't ever use it again. T…

Stuttering in Korea

I had given up on English. It's my native language, but I figured after 30 some-odd years of disfluent speech, it was time to try something else. So I signed up for language classes in Korean, rationalizing that if I was going to try to teach myself how to speak, I might as well learn a new language along the way.

This might seem completely insane, but when the prevailing theme of your conscious thoughts for multiple decades is some variant of "Why can't I say what I want to say?", you come up with lots of crazy ideas.

For background, I've been a person who stutters for my entire life. I wrote about it on this blog a few years ago, so I think it's time for a followup. I've learned a lot since then, about myself and about stuttering, but in this post I simply want to give some insight into what it's actually like to stutter, and how my speech has changed over time.

After the last stuttering post, the predominant reaction I got from friends was either &…

Why Korean Is Hard For Native English Speakers

A couple of days ago, as an experiment, I wrote my first blog post ever in a non-English language. It was an attempt to explain some of the reasons that Korean is hard to learn for native English speakers, so I figured I might as well try to write it in Korean. Those of you who actually read Korean can see how awkward the attempt was =).

In any case, the post came from an email conversation I had with The Korean from Ask a Korean, a fantastically well-written blog about all things Korea from the perspective of a Korean who moved to the United States during high school. Since I tend to geek out on language things, I figured I might as well post part of that conversation. An edited version follows.

---------

Out of the languages that I've attempted to learn so far, Korean has been the hardest. I've done a lot of meta thinking about learning Korean, and I think there are a number of reasons it's difficult for non-Koreans (and especially Westerners) to learn:

1) Obviously, the…