python-2.7google-app-engineauthenticationoauth-2.0gspread

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


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.


Solution

  • This answer may look lame, but this is what worked out for me. I actually reinstalled the os. That way it removed all the other libraries which i earlier installed. One of those libraries might be the culprit, that interferes with the cryptography files and openssl. I was unable to trace back which module/library is causing the mentioned errors. Once OS was reinstalled, i went on to install cyptography, openssl using the links you probably would have done before coming into this error.

    Before you go through my way, make sure the six.py has the version 1.9.0 in both /Library/Python/2.7/site-packages and /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

    Even if you go through my way, do the above also.

    I was so desperate that i reinstalled the os. I came to this decision because the same code that is in production works while it doesnt work on dev. I understood its some dependency error.