Installation Fails on Mac OS X 10.11 Beta 6 and GM #2350

Closed
ColtonProvias opened this Issue Sep 17, 2015 · 17 comments

Projects

None yet
@ColtonProvias

Python Version: 3.5.0
OS Version: Mac OS X 10.11 Beta 6 and GM tested.

Running setup.py install for cryptography
    Complete output from command /Users/coltonprovias/Development/MyNewLeaf/bin/python3.5 -c "import setuptools, tokenize;__file__='/private/var/folders/zl/0vgdj8l96ss0_w20j9k0t7bm0000gn/T/pip-build-b7m8lm64/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/zl/0vgdj8l96ss0_w20j9k0t7bm0000gn/T/pip-he90mckx-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/coltonprovias/Development/MyNewLeaf/bin/../include/site/python3.5/cryptography:
    running install
    running build
    running build_py
    running egg_info
    writing entry points to src/cryptography.egg-info/entry_points.txt
    writing top-level names to src/cryptography.egg-info/top_level.txt
    writing dependency_links to src/cryptography.egg-info/dependency_links.txt
    writing src/cryptography.egg-info/PKG-INFO
    writing requirements to src/cryptography.egg-info/requires.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*' found under directory 'vectors'
    writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
    running build_ext
    generating cffi module 'build/temp.macosx-10.11-x86_64-3.5/_commoncrypto.c'
    already up-to-date
    generating cffi module 'build/temp.macosx-10.11-x86_64-3.5/_padding.c'
    already up-to-date
    generating cffi module 'build/temp.macosx-10.11-x86_64-3.5/_constant_time.c'
    already up-to-date
    generating cffi module 'build/temp.macosx-10.11-x86_64-3.5/_openssl.c'
    already up-to-date
    building '_openssl' extension
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c build/temp.macosx-10.11-x86_64-3.5/_openssl.c -o build/temp.macosx-10.11-x86_64-3.5/build/temp.macosx-10.11-x86_64-3.5/_openssl.o
    build/temp.macosx-10.11-x86_64-3.5/_openssl.c:400:10: fatal error: 'openssl/aes.h' file not found
    #include <openssl/aes.h>
             ^
    1 error generated.
    error: command 'clang' failed with exit status 1

This is due to Apple dropping support for OpenSSL and moving to their own library.

Workaround for those encountering issue:

Install OpenSSL via Homebrew and then run the following command:

env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography

No other issues encountered yet.

@reaperhulk
Member

Yeah, we're aware of the change. Apple's removal of the El Capitan OpenSSL headers is (part of) why we chose to start shipping binary wheels for 10.10+. Our wheels are relatively conservative at the moment though so system Python (as well as Python 3.5) does not receive the wheels. We've documented the required dependencies (OpenSSL from homebrew or macports) here, although it lacks the nuance described above.

We'll be shipping universal (32-bit/64-bit) wheels in the next release along with Python 3.5 wheels to simplify this.

Thanks for the report!

@reaperhulk reaperhulk closed this Sep 17, 2015
@adamtheturtle

For anyone viewing this because installing a package which installs cryptography with Homebrew fails, you can add the following to your recipe:

depends_on "openssl" and

ENV["LDFLAGS"] = "-L#{opt_prefix}/openssl/lib"
ENV["CFLAGS"] = "-I#{opt_prefix}/openssl/include"
@gam-phon
gam-phon commented Oct 4, 2015

I have encountered this and the command provided in the first comment solve the issue. Running on python 2.7

@nelsonvarela

I had the same problem and resolved it by upgrading globally installed virtualenv, setuptools and pip

@busla
busla commented Jan 7, 2016

the OP solution worked for me, thanks!
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography

@reaperhulk
Member

Anyone still experiencing this issue should upgrade their pip, as it's highly likely that their installation is out of date. An up to date pip will download a binary wheel of cffi and cryptography and will not require any compilation :)

@JoaquinKeller

the issue remains with pypy, this solution (proposed above) worked well for me:
sudo -H env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pypy -m pip install -U cryptography

@jamesone

env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography - After an hour trying different solutions this was the one that fixed it for me.

@idkjs
idkjs commented Mar 6, 2016

Above solution does not work for me.
build/temp.macosx-10.11-x86_64-2.7/_openssl.c:431:10: fatal error:
'openssl/aes.h' file not found
#include <openssl/aes.h>
I tried running env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography in my user root and also inside my virtualenv environement, the running ./env/bin/python setup.py install inside my env folder. Still doesnt work. Perhaps the solution is no longer viable on 10.11? Any ideas? Thank you.

@alex
Member
alex commented Mar 6, 2016

Your best bet is to upgrade to the latest version of pip; then you'll get cryptography distributed as a wheel.

@idkjs
idkjs commented Mar 6, 2016

I upgraded previously to pip -V
pip 8.1.0 from /usr/local/lib/python2.7/site-packages (python 2.7)

Should i go back to 8.03?

@alex
Member
alex commented Mar 6, 2016

pip 8.1.0 is fine

On Sun, Mar 6, 2016 at 9:29 AM, Alain Armand notifications@github.com
wrote:

I upgraded previously to pip -V
pip 8.1.0 from /usr/local/lib/python2.7/site-packages (python 2.7)

Should i go back to 8.03?

โ€”
Reply to this email directly or view it on GitHub
#2350 (comment).

"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084

@idkjs
idkjs commented Mar 6, 2016

Any other ideas?

@GregIngelmo

OP solution worked for me...

@fluency0105

it works ! On python 2.7,el captain 10.11.2.

@tomck tomck added a commit to tomck/core that referenced this issue Jun 22, 2016
@tomck tomck Have pip update itself in virtualenv first
On macOS El Capitan, the virtualenv created uses an older version of pip which must compile the cryptography wheel. This fails per pyca/cryptography#2350. Having the virtualenv pip update itself before running resolves this issue which prevents ./bin/run.sh from completing "Installing Python requirements" on macOS 10.11.
b7009b4
@deyvsh
deyvsh commented Sep 5, 2016 edited

For posterity, I had to use virtualenv-burrito upgrade to upgrade pip because (you guessed it) I'm using the excellent virtualenv-burrito.
Without doing this I got the following error:

Not uninstalling pip at /Users/dave/.venvburrito/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg, outside environment /Users/dave/.virtualenvs/ansible2++/bin/..

@CJeffrey

WOW! Many thanks! This just fixed my problem!

@kvz kvz referenced this issue in freyproject/frey Nov 9, 2016
Open

Binary install of Ansible #51

@pcraig3 pcraig3 added a commit to alphagov/digitalmarketplace-supplier-frontend that referenced this issue Dec 14, 2016
@pcraig3 pcraig3 Kill the cryptography bug fdad4e2
@pcraig3 pcraig3 added a commit to alphagov/digitalmarketplace-supplier-frontend that referenced this issue Dec 14, 2016
@pcraig3 pcraig3 Kill the cryptography bug
We've had a problem installing cryptography on local machines,
one solution to which is to make sure your is updated.

This pull request would add a step to the Makefile to always
upgrade pip before installing the rest of the requirements.

If we want to do this, I can port it to the other apps.

[Issue on github](pyca/cryptography#2350 (comment))
983a12a
@pcraig3 pcraig3 referenced this issue in alphagov/digitalmarketplace-supplier-frontend Dec 14, 2016
Merged

[Proposal] Upgrade pip every time to kill the cryptography bug #577

@pcraig3 pcraig3 added a commit to alphagov/digitalmarketplace-supplier-frontend that referenced this issue Dec 15, 2016
@pcraig3 pcraig3 Kill the cryptography bug
We've had a problem installing cryptography on local machines,
one solution to which is to make sure your is updated.

This pull request would add a step to the Makefile to always
upgrade pip before installing the rest of the requirements.

If we want to do this, I can port it to the other apps.

[Issue on github](pyca/cryptography#2350 (comment))
3621a03
@pcraig3 pcraig3 added a commit to alphagov/digitalmarketplace-supplier-frontend that referenced this issue Dec 16, 2016
@pcraig3 pcraig3 Kill the cryptography bug
We've had a problem installing cryptography on local machines,
one solution to which is to make sure your is updated.

This pull request would add a step to the Makefile to always
upgrade pip before installing the rest of the requirements.

If we want to do this, I can port it to the other apps.

[Issue on github](pyca/cryptography#2350 (comment))
a9fc4be
@pcraig3 pcraig3 added a commit to alphagov/digitalmarketplace-buyer-frontend that referenced this issue Dec 16, 2016
@pcraig3 pcraig3 Kill the cryptography bug
We've had a problem installing cryptography on local machines,
one solution to which is to make sure your 'pip' is updated.

This pull request would add a step to the Makefile to always
upgrade pip before installing the rest of the requirements.

Same as was in the supplier app.

[Issue on github](pyca/cryptography#2350 (comment))
8baef6e
@pcraig3 pcraig3 added a commit to alphagov/digitalmarketplace-admin-frontend that referenced this issue Dec 16, 2016
@pcraig3 pcraig3 Kill the cryptography bug
We've had a problem installing cryptography on local machines,
one solution to which is to make sure your 'pip' is updated.

This pull request would add a step to the Makefile to always
upgrade pip before installing the rest of the requirements.

Same as was in the supplier app.

[Issue on github](pyca/cryptography#2350)
310aab4
@pcraig3 pcraig3 referenced this issue in alphagov/digitalmarketplace-admin-frontend Dec 16, 2016
Merged

Kill the cryptography bug #238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment