Python 3.5 OpenSSL error

1.9k Views Asked by At

SO I am was working with errbot and fired up a virtualenv with python3.5. When I run the errbot command I get this error

from OpenSSL import crypto
  File "/Users/me/workspace/chatbotv2/chatbot_venv3/lib/python3.5/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/Users/me/workspace/chatbotv2/chatbot_venv3/lib/python3.5/site-packages/OpenSSL/rand.py", line 12, in <module>
    from OpenSSL._util import (
  File "/Users/me/workspace/chatbotv2/chatbot_venv3/lib/python3.5/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/Users/me/workspace/chatbotv2/chatbot_venv3/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 250, in <module>
    _verify_openssl_version(Binding.lib.SSLeay())
  File "/Users/me/workspace/chatbotv2/chatbot_venv3/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 230, in _verify_openssl_version
    "You are linking against OpenSSL 0.9.8, which is no longer "

This is 'asked to death' topic on SO so obviously I was abel to get a solution asap. I followed this answer. However When I run brew link --force openssl I get this :

Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
  -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

For which I tried :

export CPPFLAGS='-I/usr/local/opt/openssl/include'
export LDFLAGS='-L/usr/local/opt/openssl/lib'

After this I am lost and do not know what to do. When I try : python -c "import ssl; print (ssl.OPENSSL_VERSION)" I still get OpenSSL 0.9.8zg 14 July 2015. I am on OSX

1

There are 1 best solutions below

0
On

Upgrade your pip. pip 8.1+ will download a binary wheel that will have cryptography precompiled. If you want to compile it yourself the correct environment variables for homebrew can also be found in the docs on the installation page.