Ubuntu Lucid ships Python 2.6. Python 2.5 has been completely removed. Google AppEngine requires Python 2.5 to work. So if you want to develop AppEngine apps on a Lucid machine, you need to setup your working environment manually. This post tells how to do it.
(I assume you install Python to
/opt/python2.5 and the user can write there; I assume you create a virtual environment, a directory where Python packages are installed, in
$HOME/.py25. Choose different locations if you like and adjust instructions accordingly)
1. Get the latest Python 2.5 release and build it from source.
Make sure that you have necessary development libraries installed. In particular, you probably want to install
libsqlite3-dev before building Python. Otherwise you'll have a Python without SQLite3 support, and GAE will not work with it.
Go to a directory where you build software and do from the command line:
wget http://www.python.org/ftp/python/2.5.5/Python-2.5.5.tar.bz2 -O - | tar jx cd Python-2.5.5 ./configure --prefix=/opt/python2.5 make -j 2 make install cd ..
If there are configure errors, likely missing packages or header files for C libraries, install them and repeat.
virtualenv and setup a new Python environment
You will use a separate Python environment for AppEngine. So you will not mess with system packages. Fetch and unpack virtualenv:
wget http://bitbucket.org/ianb/virtualenv/get/tip.gz -O - | tar zx
Run it to get a new environment in
~/.py25 (I use full path to the newly installed Python 2.5 here):
/opt/python2.5/bin/python virtualenv/virtualenv.py ~/.py25
Now to enable Python 2.5 you can source activate script from this environment, and to disable deactivate it:
$ which python ; python --version /usr/bin/python Python 2.6.5 $ source ~/.py25/bin/activate (.py25)$ which python ; python --version /home/sergey/.py25/bin/python Python 2.5.5 (.py25)$ deactivate
To install packages for Python 2.5 you can use pip. For example, to install Python Imaging Library (PIL), which is used by AppEngine, run:
(.py25)$ pip install PIL
Or you can use
-E ~/.py25 option of
pip without activating the environment.
3. Run the development server
Put your GAE SDK in the PATH, get the source of the application, and run the server. For example:
(.py25)$ git clone http://github.com/anotherjesse/webpy-appengine-helloworld.git gae-hello ... (.py25)$ cd gae-hello ... (.py25)$ dev_appserver.py . INFO 2010-06-28 16:35:04,755 appengine_rpc.py:159] Server: appengine.google.com INFO 2010-06-28 16:35:04,761 appcfg.py:357] Checking for updates to the SDK. INFO 2010-06-28 16:35:05,068 appcfg.py:371] The SDK is up to date. INFO 2010-06-28 16:35:05,106 dev_appserver_main.py:431] Running application hello-webpy on port 8080: http://localhost:8080