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

영어가 모국어인 사람들은 왜 한국어를 배우기가 어려운 이유

이 포스트는 내 처음 한국어로 블로그 포스트인데, 한국어에 대하니까 잘 어울린다. =) 자, 시작합시다! 왜 외국사람에게 한국어를 배우기가 어렵다? 난 한국어를 배우고 있는 사람이라서 이 문제에 대해 많이 생각하고 있었다. 여러가지 이유가 있는데 오늘 몇 이유만 논할 것이다. 1. 분명히 한국어 문법은 영어에 비해 너무 많이 다른다. 영어는 “오른쪽으로 분지(分枝)의 언어"라고 하는데 한국어는 “왼쪽으로 분지의 언어"이다. 뜻이 무엇이나요? 예를 보면 이해할 수 있을 것이다. 간단한 문장만 말하면 (외국어를 말하는 남들은 간단한 문장의 수준을 지낼 수가 약간 드물다), 간단한 걸 기억해야 돼: 영어는 “SVO”인데 한국어는 “SOV”이다. “I’m going to school”라고 한국어로는 “저는 학교에 가요"라고 말한다. 영어로 똑바로 번역하면 “I’m school to go”이다. 두 언어 다르는 게 목적어와 동사의 곳을 교환해야 한다. 별로 어렵지 않다. 하지만, 조금 더 어렵게 만들자. “I went to the restaurant that we ate at last week.” 한국어로는 “전 우리 지난 주에 갔던 식당에 또 갔어요"라고 말한다. 영어로 똑바로 번역하면 “I we last week went to restaurant to again went”말이다. 한국어가 왼쪽으로 분지 언어라서 문장 중에 왼쪽으로 확대한다! 이렇게 좀 더 쉽게 볼 수 있다: “전 (우리 지난 주에 갔던 식당)에 또 갔어요”. 주제가 “전"이고 동사가 “갔다"이고 목적어가 “우리 지난 주에 갔던 식당"이다. 영어 문장은 오른쪽으로 확대한다: I (S) went (V) to (the restaurant (that we went to (last week))) (O). 그래서 두 숙어 문장 만들고 싶으면 생각속에서도 순서를 변해야 된다. 2. 첫 째 점이니까 다른 사람을 자기 말을 아라들게 하고 싶으면, 충분히

10 other things South Korea does better than anywhere else

Recently this article about 10 things that South Korea does better than anywhere else  has been making the rounds on social media, but when I first read it, I couldn't tell if it was sincere or satire. A few of the items on the list are not very positive, such as "overworking" and "using credit cards". So, I thought I would try to put together a better list. Here are 10 other things South Korea does better than anywhere else: 1) Small side dishes, a.k.a. " banchan " (반찬) Banchan are by far my favorite aspect of Korean cuisine. Rather than the "appetizer and main dish" approach of the West, a Korean meal is essentially built around small dishes. Even a 5,000 won (about $5 USD) meal at a mall food court will come with two to four banchan in addition to the "main", and often people will actually choose restaurants based  on the banchan (e.g., seolleongtang , or beef bone broth soup, places tend to have the tastiest kimchi). Ther

The King's Speech (and me)

Tonight, I finally gathered the courage to watch The King's Speech . Why did I need courage to watch a movie, you might ask? The reason is both simple and intricately complex: I'm a stutterer (Edit: person who stutters; "stutterer" is not who I am, but something that I do from time to time), and I have been for as long as I remember. Well, there it is - I've said it. To be fair, I actually don't remember stuttering when I was little. My first very distinct memory of stuttering was sometime in seventh grade, when I had trouble saying "nosotros" (we/us) in Spanish class. But I also remember knowing I was going to have trouble saying it, because we were going around the room, and I counted ahead to see what I was going to have to say. Which means by that point I was already stuttering. When did it start? That's a question for another day. So why am I publicizing this fact now? First, I'm in the midst of a lifelong attempt to "cure&quo