1

I'm on Mac OSX El-Capitan version 10.11.5. When I try to install pyopenssl via pip, it fails with fatal error: 'openssl/ssl.h' file not found. See below.

Why is this file not there? And how can I get this pip install to work?

$ pip install pyopenssl==0.13.1
Collecting pyopenssl==0.13.1
  Using cached pyOpenSSL-0.13.1.tar.gz
Building wheels for collected packages: pyopenssl
  Running setup.py bdist_wheel for pyopenssl ... error
  Complete output from command /Users/my_user/test-env/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-build-NFALPZ/pyopenssl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/tmpUgU3gIpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.11-intel-2.7
  creating build/lib.macosx-10.11-intel-2.7/OpenSSL
  copying OpenSSL/__init__.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
  copying OpenSSL/tsafe.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
  copying OpenSSL/version.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
  creating build/lib.macosx-10.11-intel-2.7/OpenSSL/test
  copying OpenSSL/test/__init__.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
  copying OpenSSL/test/util.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
  copying OpenSSL/test/test_crypto.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
  copying OpenSSL/test/test_rand.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
  copying OpenSSL/test/test_ssl.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
  running build_ext
  building 'OpenSSL.crypto' extension
  creating build/temp.macosx-10.11-intel-2.7
  creating build/temp.macosx-10.11-intel-2.7/OpenSSL
  creating build/temp.macosx-10.11-intel-2.7/OpenSSL/crypto
  cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c OpenSSL/crypto/crypto.c -o build/temp.macosx-10.11-intel-2.7/OpenSSL/crypto/crypto.o
  In file included from OpenSSL/crypto/crypto.c:16:
  In file included from OpenSSL/crypto/crypto.h:30:
  OpenSSL/crypto/x509.h:17:10: fatal error: 'openssl/ssl.h' file not found
  #include <openssl/ssl.h>
           ^
  1 error generated.
  error: command 'cc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for pyopenssl
  Running setup.py clean for pyopenssl
Failed to build pyopenssl
Installing collected packages: pyopenssl
  Running setup.py install for pyopenssl ... error
    Complete output from command /Users/my_user/test-env/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-build-NFALPZ/pyopenssl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-G7av9L-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/my_user/test-env/include/site/python2.7/pyopenssl:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.11-intel-2.7
    creating build/lib.macosx-10.11-intel-2.7/OpenSSL
    copying OpenSSL/__init__.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
    copying OpenSSL/tsafe.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
    copying OpenSSL/version.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL
    creating build/lib.macosx-10.11-intel-2.7/OpenSSL/test
    copying OpenSSL/test/__init__.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
    copying OpenSSL/test/util.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
    copying OpenSSL/test/test_crypto.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
    copying OpenSSL/test/test_rand.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
    copying OpenSSL/test/test_ssl.py -> build/lib.macosx-10.11-intel-2.7/OpenSSL/test
    running build_ext
    building 'OpenSSL.crypto' extension
    creating build/temp.macosx-10.11-intel-2.7
    creating build/temp.macosx-10.11-intel-2.7/OpenSSL
    creating build/temp.macosx-10.11-intel-2.7/OpenSSL/crypto
    cc -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c OpenSSL/crypto/crypto.c -o build/temp.macosx-10.11-intel-2.7/OpenSSL/crypto/crypto.o
    In file included from OpenSSL/crypto/crypto.c:16:
    In file included from OpenSSL/crypto/crypto.h:30:
    OpenSSL/crypto/x509.h:17:10: fatal error: 'openssl/ssl.h' file not found
    #include <openssl/ssl.h>
             ^
    1 error generated.
    error: command 'cc' failed with exit status 1

    ----------------------------------------
Command "/Users/my_user/test-env/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-build-NFALPZ/pyopenssl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-G7av9L-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/my_user/test-env/include/site/python2.7/pyopenssl" failed with error code 1 in /private/var/folders/q7/zl0gz8xj7ps8wswmxkqsf9khwzyc1z/T/pip-build-NFALPZ/pyopenssl/
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
  • Try with this: brew install openssl brew link openssl --force – julian salas Aug 24 '16 at 15:34
  • Doing `$ brew link openssl --force` yields the following error: `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` – Saqib Ali Aug 24 '16 at 15:44
  • Look at this http://stackoverflow.com/questions/38670295/brew-refusing-to-link-openssl, maybe you can solved your issue. Give me heads up if anything please. – julian salas Aug 24 '16 at 15:54

0 Answers0