CryptoUnavailableError: No crypto library availabl

2019-05-21 01:29发布

问题:

The error is in gspread authentication. Got

oauth2client.client.CryptoUnavailableError: No crypto library available

I have installed both pyOpenSSL and pycrypto. With the Crypto folder obtained after installation of pycrypto in my app directory. I dug deeper on why the above error still persists. I found

from oauth2client import crypt

to be the cause. The following ImportError is being raised.

ImportError: No encryption library found. Please install either PyOpenSSL, or PyCrypto 2.6 or later

Please help. I earlier(few months ago) got it working by adding the following in my app.yaml. But this time it is not working.

libraries:

- name: pycrypto
  version: "latest"

- name: ssl
  version: latest  

I use mac for development in case you need this to help me out. The thing is gspread used properly work using oauth2client. Today i tried to install google cloud storage client. I might have done something unknowningly during the installation process. After which the gspread authentication keeps failing. I have no clue on what to do next.

But note that the gspread authentication works flawlessly on production. I verified by pulling the production code.

回答1:

I was able to fix this issue by reinstalling pyOpenSSL, cryptography.

But now i got another error.

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

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