How to install Python ssl module on Windows?

Jader Dias picture Jader Dias · Feb 14, 2010 · Viewed 35.1k times · Source

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?

Answer

AndiDog picture AndiDog · Feb 14, 2010

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.