Search code examples
pythongoogle-app-enginesslubuntu-9.10

How do I configure multiple Ubuntu Python installations to avoid App Engine's SSL error?


I have Karmic Koala which has Python 2.6 installed by default.

However I can't run any Python App Engine projects because they require Python 2.5 and python ssl.

To install ssl I installed python2.5-dev first while following some instructions I found elsewhere.

sudo apt-get install libssl-dev
sudo apt-get install python-setuptools
sudo apt-get install python2.5-dev 
sudo easy_install-2.5 pyopenssl

However, I am afraid this is not good for my Ubuntu installation since Ubuntu expects to see version 2.6 of Python when you type 'python' on the command line. Instead, it says '2.5.5'.

But App Engine still doesn't work after all this. I continue to get an SSL-related error whenever I try to run my Python app:

AttributeError: 'module' object has no attribute 'HTTPSHandler'

UPDATE1: Just checked whether SSL actually installed as a result of those commands by typing this:

$ python2.5
Python 2.5.5 (r255:77872, Apr 29 2010, 23:59:20) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named ssl
>>> 

As you can see, SSL is still not installed, which explains the continuing App Engine error.

UPDATE2:

I tried to revert to the original default version of Python by doing this:

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

in my /usr/bin/local folder.

Now I get Python 2.6.4 when I type 'python' on the command line.

But this doesn't solve my App Engine SSL issue.

If anyone knows how I can dig myself out of this hole, I would appreciate it.


Solution

  • You should be able to simply install Ubuntu's standard copy of Python 2.5. The SSL module isn't a requirement - as the warning message says, it's necessary if you want to do certificate validation, but that's all.

    The error you're getting with a missing 'HTTPSHandler' is probably due to installing a version of Python that was compiled without SSL support (this is independent of the ssl module, which is what does certificate validation) - again, try installing the standard version.

    As far as version selection goes, installing Python 2.5 shouldn't intefere with the default system version - there's a selector tool for choosing which version is the default - so you can simply run the dev_appserver etc with 'python2.5 dev_appserver.py'.