ImportError: No module named cryptography.hazmat.bindings._openssl

Prajapathy3165 picture Prajapathy3165 · Sep 11, 2015 · Viewed 22.9k times · Source

CryptoUnavailableError: No crypto library available and from oauth2client import crypt failure.

I had the above error mentioned in the link. I was able to fix that by reinstalling pyOpenSSL and cryptography. But now the following error is being raised.

ImportError: No module named cryptography.hazmat.bindings._openssl

Here _openssl is a unix executable file(_openssl.so). The following is the import statement

from cryptography.hazmat.bindings._openssl import ffi, lib

The above code is in bindings.py in cryptography module. These are all linked to gspread authentication using oauth2client. Please help me out. Im struggling with this.

Update: The issue was caused by some dependency failure. I was unable to find where the dependency was failing though.. Reinstalled all the libraries from top. That kind of fixed the issue.

Answer

zhangzhy2000 picture zhangzhy2000 · Jan 27, 2019

I finally got this. It worked for me:

pip uninstall pyopenssl
pip uninstall cryptography
pip install pyopenssl
pip install cryptography