Pip and SSL certificate errors

certificatepythonssl

I am trying to install a library via pip.
I have a problem with SSL certificate, even when using the –cert.
Trying this on windows (pip version 1.5.4,python version 2.7.6):

pip --cert C:\tmp\cacert.pem install robotframework-archivelibrary --proxy http://myproxy

Getting page
https://pypi.python.org/simple/robotframework-archivelibrary/ Could
not fetch URL
https://pypi.python.org/simple/robotframework-archivelibrary/:
connection error: [Errno 1] _ssl.c:507: error:14090086:SSL
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Any ideas?

Best Answer

I had similar error messages due to our corporate firewall intercepting SSL (i.e. a transparent SSL proxy). I exported the root CA cert that signs the firewall certificate in .pem format and appended it to the following file:

C:\Python27\Lib\site-packages\pip\_vendor\requests\cacert.pem

That resolved my issue. Your issue might not be exactly the same, but if you get the right CA certificates into the above cacert.pem I'm sure you can get passed your SSL certificate verification failure.

Related Question