views:

1721

answers:

3

The Google App Engine Launcher tells me:

WARNING appengine_rpc.py:399 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 .

I downloaded the package and it contained a setup.py file. I ran:

python setup.py install

and then:

Python was built with Visual Studio 2003; blablabla use MinGW32

Then I installed MinGW32 and now the compilation doesn't work. The end of the compilation errors contains:

ssl/_ssl2.c:1561: error: `CRYPTO_LOCK' undeclared (first use in this function)

error: command 'gcc' failed with exit status 1

What should I do?

+6  A: 

Grab the openssl and libgw32c packages from the gnuwin32 project (download the "Developer files"!) and extract them where you installed gnuwin32 - or if you don't have gnuwin32 tools yet, you can extract it anywhere (e.g. "C:\Program Files\gnuwin32"). Enter the gnuwin32 directory in the "setup.py" file (replace "C:\Utils\GnuWin32" in line 154).

Then you can build the ssl module without problems. I tested it myself, using GCC "4.3.2-tdm-2 mingw32" and with the command line setup.py build -cmingw32 (-cmingw32 forces MinGW as I also have Microsoft's compiler installed). Execute setup.py install after the successful build to install ssl.

AndiDog
the openssl installer you linked already installed some (or all) of the files present in the libgw32c compressed file.
Jader Dias
even after I followed your instructions I got the same problem when building the `ssl module
Jader Dias
Sorry, I forgot to mention that you need to change setup.py according to your gnuwin32 path. Edited the answer.
AndiDog
@Andi thanks! now it works!
Jader Dias
A: 

This blog may help you, http://malei39.blogspot.com/2010/02/install-ssl-module-for-pyhon-254.html

mal39
A: 

I had to use the following modification of AndiDog's approach:

setup.py build -cmingw32
setup.py install --skip-build

Without the --skip-build option, the install would try to build again and complain about MSVC again:

error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.

Also, initially when using the build command I had a lot of errors like this:

build\temp.win32-2.5\Release\ssl\_ssl2.o:_ssl2.c:(.text+0x1d): undefined reference to `_imp__PyImport_ImportModule'
build\temp.win32-2.5\Release\ssl\_ssl2.o:_ssl2.c:(.text+0x34): undefined reference to `_imp__PyObject_GetAttrString'
build\temp.win32-2.5\Release\ssl\_ssl2.o:_ssl2.c:(.text+0x53): undefined reference to `_imp__PyCObject_AsVoidPtr'

This was because I had originally installed the 64bit version of Python 2.5.4 (python-2.5.4.amd64.msi). I removed that and installed the 32bit version (python-2.5.4.msi). This includes the libpython25.a file which the build command was looking for.

Saxon Druce