pip is broken with AttributeError: ‘module’ object has no attribute ‘SSL_ST_INIT’

This error is quite frustrating, and it has been occurring to me when I try to move old django sites to a new server. It is frustrating because once this happens, your pip is broken and you can’t do anything with your environment. It happens when there is an old openssl package installed in your site packages and you do a pip install requirements.txt

I found a quick way to fix it though. Simply delete the old openssl package from your site-packages. In my case it was

rm -r -f /Users/me/.virtualenvs/myenv/lib/python2.7/site-packages/OpenSSL/

It may be a little scary, but this has worked for me every time. This immediately fixed my problem and pip was back to normal.

This entry was posted in Linux, Mac OS X, python, SSL. Bookmark the permalink.

Comments are closed.