Pip Error : 'module' object has no attribute 'Cryptography_HAS_SSL_ST'

Ubuntu 16.04.3 here:

I think I have fixed this by removing the python-openssl package (and it's dependencies) with:

apt-get --auto-remove remove python-openssl

Then installing the latest version with pip:

pip install pyOpenSSL

Of course, if you install another apt package that depends on it, it'll pull it back in. I hope if you use pip for everything you can from now on instead of apt, it should be fine.

Edit: as of January 2019 this issue doesn't seem to exist any more.


If even pip is not working then try following:

sudo easy_install -U cffi
sudo easy_install -U cryptography

It works for me.


I was able to resolve this by deleting the openssl python lib and reinstalling (purge before install did not work):

$ sudo rm -rf /usr/local/lib/python2.7/dist-packages/OpenSSL/
$ sudo apt install --reinstall python-openssl

To fix it on RHEL/CentOS:

sudo rm -rf /usr/lib/python2.7/site-packages/OpenSSL/
sudo yum install pyOpenSSL

This did it for me on CentOS 7. Cheers!