Fixing appengine SSL error on Ubuntu 10.04

I figured I’d document this since I have to do it again. If you are using Google App Engine and you get the following:

2011-01-26 14:17:45,892 WARNING appengine_rpc.py:405 ssl module not found.
Without the ssl module, the identity of the remote host cannot be verified, and
connections may NOT be secure. To fix this, please install the ssl module from
http://pypi.python.org/pypi/ssl .
To learn more, see http://code.google.com/appengine/kb/general.html#rpcssl .

You download the file from the page suggested in the error. Then do this:

vanhoudn@gauze:~/Downloads$ tar xzf ssl-1.15.tar.gz
vanhoudn@gauze:~/Downloads$ cd ssl-1.15/
vanhoudn@gauze:~/Downloads/ssl-1.15$ python2.5 setup.py build

If it worked, great! Just do sudo python2.5 setup.py install and you are done. If not, you may have run into this error:

vanhoudn@gauze:~/Downloads/ssl-1.15$ python2.5 setup.py
looking for /usr/include/openssl/ssl.h
looking for /usr/local/ssl/include/openssl/ssl.h
looking for /usr/contrib/ssl/include/openssl/ssl.h
Traceback (most recent call last):
File "setup.py", line 167, in
ssl_incs, ssl_libs, libs = find_ssl()
File "setup.py", line 142, in find_ssl
raise Exception("No SSL support found")
Exception: No SSL support found

You can fix that by installing the relevant parts of the SSL source code with sudo apt-get install libssl-dev. Trying again you might get:

vanhoudn@gauze:~/Downloads/ssl-1.15$ python2.5 setup.py build
looking for /usr/include/openssl/ssl.h
looking for /usr/include/krb5.h
looking for /usr/kerberos/include/krb5.h
running build
running build_py
running build_ext
building 'ssl._ssl2' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I./ssl/2.5.1 -I/usr/include/python2.5 -c ssl/_ssl2.c -o build/temp.linux-i686-2.5/ssl/_ssl2.o
ssl/_ssl2.c:17:20: error: Python.h: No such file or directory
In file included from ssl/_ssl2.c:76:
./ssl/2.5.1/socketmodule.h:112: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
.... lots of other errors ....
error: command 'gcc' failed with exit status 1

You can fix that by installing the headers for python2.5. Apparently, when I initially installed deadsnakes I forgot to install the headers. Easy enough with sudo apt-get install python2.5-dev. But not I get a bluetooth related error:


In file included from ssl/_ssl2.c:76:
./ssl/2.5.1/socketmodule.h:45:33: error: bluetooth/bluetooth.h: No such file or directory
./ssl/2.5.1/socketmodule.h:46:30: error: bluetooth/rfcomm.h: No such file or directory
./ssl/2.5.1/socketmodule.h:47:29: error: bluetooth/l2cap.h: No such file or directory
./ssl/2.5.1/socketmodule.h:48:27: error: bluetooth/sco.h: No such file or directory

So, you guessed it: sudo apt-get install libbluetooth-dev. Then finally success! Finish with sudo python2.5 setup.py install and the GAE error goes away!

7 Responses to Fixing appengine SSL error on Ubuntu 10.04

  1. Excellent! This saved my day. I run Ubuntu 10.10 + Python2.5 + Google App Engine. Thanks a lot.

  2. Hello, Nathan!

    Thanks for your article, it’s almost the exact path that I walked through =)
    With one exception – ssl still fails in python 2.5 for me.

    I installed ssl 1.15:

    elija@elija-desktop:~/Downloads/ssl-1.15$ sudo python2.5 setup.py install
    looking for /usr/include/openssl/ssl.h
    looking for /usr/include/krb5.h
    running install
    running build
    running build_py
    running build_ext
    running install_lib
    running install_data
    running install_egg_info
    Removing /usr/local/lib/python2.5/site-packages/ssl-1.15-py2.5.egg-info
    Writing /usr/local/lib/python2.5/site-packages/ssl-1.15-py2.5.egg-info

    And this is what I get:

    elija@elija-desktop:~/Downloads/ssl-1.15$ python2.5
    ...
    >>> import ssl
    Traceback (most recent call last):
    File "", line 1, in
    File "ssl/__init__.py", line 61, in
    import _ssl2 # if we can't import it, let the error propagate
    ImportError: No module named _ssl2

    Any idea what’s the problem?

    I’m using Ubuntu 10.10, installed python 2.5 from source.

    • I’m not really too sure. A quick google search turned up this blog which basically says to delete the __init__.pyc file under site-packages/ssl. That might not work since the blog mentioned python2.4 instead of 2.5. HTH.

      If you get tired of fighting with building from source, you can use the deadsnakes binaries. I’ve found it to work pretty well.

      • Yes, thank you, I found this one, too.
        It wasn’t very helpful however =)

        I think I’ll go with launching GAE application via python 2.6. That should so for me.

        Thanks for quick response anyway!

  3. thanks a lot, I thought you wrote this article for me :) )

  4. Thanks a lot, just what I was needing.
    No more error message now.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>