Correctly installing pyOpenSSL for Python (Windows)
Question: I'm trying to make an application that automatically updates a Google Plus
spreadsheet. In order to do this I had to set up `gspread`, which also
requires pyOpenSSL in order to work. Without it, it throws this error:

> CryptoUnavailableError: No crypto library available

Using `pip`, I type the command:

    
    
    pip install pyopenssl
    

And import using:

    
    
    from OpenSSL import SSL
    

When I try to run the code, I receive the following error:

> ImportError: No module named cryptography.hazmat.bindings.openssl.binding

I've tried reinstalling pyOpenSSL multiple times, and also tried reinstalling
the cryptography dependency (as well as attempting to install previous
versions of pyOpenSSL).

This problem is documented a few times, but the only solution I haven't tried
is doing a fresh install of python, or the OS.

Any suggestions? Thanks in advance.


Answer: **This is how I solved it in my Ubuntu Desktop. In windows you need to figure
out the solution but the real reason for this problem is same both in Linux
and Windows**

PyOpenSSL 14.x+ uses cffi-based cryptography package, maybe this is a cause of
your issue - cffi needs libffi (or libffi-dev) system package, this is a new
non-Python dependency.

First do this

    
    
    sudo apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev
    

and then

    
    
    pip install cryptography
    

Note the key module here is _libffi-dev_..I think instead of `apt-get`, you
can also use `pip install` if you have pip installed already

**In the meantime this is the documentation says about pyOpenSSL binding**

> This is a “Hazardous Materials” module. You should ONLY use it if you’re
> 100% absolutely sure that you know what you’re doing because this module is
> full of land mines, dragons, and dinosaurs with laser guns.

That's a pretty bold warning I must say

