If you have tried installing / updating pyOpenSSL to version 0.14 you may have run into an issue when it tries to install the required package cryptography. The specific error I encountered was:
raise ffiplatform.VerificationError(error) | |
cffi.ffiplatform.VerificationError: importing '/private/tmp/pip_build_root/cryptography/cryptography/hazmat/bindings/__pycache__/_cffi__x5eaa210axf0ae7e21.so': dlopen(/private/tmp/pip_build_root/cryptography/cryptography/hazmat/bindings/__pycache__/_cffi__x5eaa210axf0ae7e21.so, 2): Symbol not found: _CRYPTO_malloc_debug_init | |
Referenced from: /private/tmp/pip_build_root/cryptography/cryptography/hazmat/bindings/__pycache__/_cffi__x5eaa210axf0ae7e21.so | |
Expected in: flat namespace | |
in /private/tmp/pip_build_root/cryptography/cryptography/hazmat/bindings/__pycache__/_cffi__x5eaa210axf0ae7e21.so |
To get around this, you’ll need to set some environment variables before installing cryptography:
# install via MacPorts | |
sudo port install openssl | |
sudo env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/opt/local/lib" CFLAGS="-I/opt/local/include" pip install cryptography | |
# install via Homebrew | |
brew install openssl | |
env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography |
A pull request has been opened to add this to the documentation but as of this writing it has not yet been merged.
I owe you a beer.
Glad I could help.
THANK YOU!!! I was going crazy before to read your post and I finally solved 🙂
thanks man!
Thanks. It saved my day 😉
Reblogged this on wilane and commented:
Just to make sure this isn’t lost somewhere in cyberspace, thanks.
This post saved yet more lives today. Thanks!
Thanks alot! Just tried it on OS X El Capitan with homebrew and it works like a charm
Good day !
I will be very happy, if you told me: that i doing wrong ?
File “C:\Python27\lib\cryptography\hazmat\bindings\openssl\binding.py”, line 1
3, in
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: No module named _openssl
P.S. I think. that file: _openssl.py is absent on my HDD
With best regrets!
You need to install OpenSSL:
https://wiki.openssl.org/index.php/Binaries