-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip install cryptography
broken on OS X El Capitan
#2692
Comments
Upgrade your pip as you appear to be using a version that predates support for binary wheels. What does |
No, I use wheel support myself since a long time. There seems to be a reason that prevents |
Perhaps an explanation of why cryptography prefers wheels would be helpful here. cryptography ships with an OpenSSL backend. This backend needs to be compiled and linked against libssl and libcrypto. OS X historically has shipped with OpenSSL, but Apple made the decision to deprecate and strongly recommend against its use starting with OS X 10.7. While we previously supported linking against it, this support is being dropped as the 0.9.8 series is no longer supported by the OpenSSL project and is also so old that major features necessary for modern TLS support are not present. Since we need to compile against a newer version then an alternate version of OpenSSL must be installed (typically by either homebrew or macports). Unfortunately, since Apple still ships the 0.9.8 libraries (but not the headers as of OS X El Capitan) these newer OpenSSL libraries can't safely be put in the default lib search path. So, our options were to either force anyone who wanted to install cryptography to install openssl separately and understand the C toolchain enough to provide the proper include/linker flags, or build a static wheel that would allow Of course, we do still document how to build it on OS X using In general this binary wheel resolution process is pretty reliable, but sometimes edge cases occur. We currently upload two OS X wheels for each Python we support (a 10_6 SDK version and a 10_10). pip 8 altered its wheel compatibility code to prefer the newest compatible wheel. In your case it appears you're running on Mavericks, so the 10_6 SDK wheel should have been downloaded. To test I just booted a Mavericks VM and using pip 8.0.2 I got the 10_6 wheel as expected with |
Thanks for the explanation. No, as stated on top, I used El Capitan, which is 10.11.2 .
The setup script should configure itself and find needed arguments. The problem is that due This was what actually happened, when I tried
|
I think I was causing the problem by using another python version (stackless python). Cheers - Chris |
There's no way for the build to configure itself, if OpenSSL's headers aren't on your platform's include path, there's nothing we can do. |
@alex the installation paths of homebrew et.al. are a de-facto standard, |
I have a similar issue with installing Plone 5.0 and some add-ons depending on the cryptography module. I see the same include problem running buildout on MacOSX. However the workaround here is to "pip install crypography" inside the local virtual env that is used to run buildout. |
Upgrading from pip==1.3.1 to pip==9.0.1 fixed this for me |
pip install --upgrade pip |
Thanks @hanxinhisen that worked ;) |
Thanks @hanxinhisen |
brew install openssl then
So just export these env vars and rerun your favorite pip install (or better to avoid havoc in future add following to your export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" This worked for me like a charm! |
@dmitrytokarev This worked for me python3.6/site-packages/wheel/bdist_wheel.py", line 155, in get_tag
assert tag == supported_tags[0]
AssertionError
----------------------------------------
Failed building wheel for cryptography
Running setup.py clean for cryptography
Failed to build cryptography
Installing collected packages: cryptography
Running setup.py install for cryptography ... done
Successfully installed cryptography-1.6
pip list | grep cry
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
cryptography (1.6)
pycrypto (2.6.1) |
cryptography 1.7 has a py36 wheel. |
For workarounds, I liked this one better:
|
Linking the include headers into |
@reaperhulk I'm running pip 9.0.1 and python 2.7.9, but my Mac is still trying to build from source - can you help me work out why this is? (Incidentally, I got it to compile using the tip from @dmitrytokarev above) |
Due to an issue with the compilation of some of the wheels the current release has a bit less coverage than normal. Do you get a wheel if you do |
Just to add another data point, I get a wheel with 1.7.1 but 1.7.2 has no wheel & fails to build. |
This will be resolved with the release of 1.8. The original wheels for the pythons having problems were built incorrectly. PyPI doesn't allow you to upload different wheels with the same name (for good security reasons), so we can't upload new ones without either using a build tag or releasing a new version. Unfortunately pip doesn't respect wheel build tags right now, so that fix won't work either. Sorry about this. cryptography 1.8 should be out within the next week. |
Thanks for clarification! I assumed that was the case but was still seeing 1.7.2 on pypi so I thought it was worth the clarification (even for others sake!) |
@Jay54520 I get a similar error to yours but for pycrypto. Can the AssertionError be safely ignored?
|
Not sure if it is worth noting for those with python3 that "pip3" may also be used to verify, sharing just in case: pip3 install cryptography |
@dmitrytokarev Solution worked for me like a charm! pip 9.0.1 |
@dmitrytokarev thank you very much. your solution works perfectly. export CPPFLAGS="-I/usr/local/opt/openssl/include" export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" |
another solution is add global-option with your requirments |
@dmitrytokarev +1. Worked for me on MacOSX 10.12.6. Exported flags in bash, then |
Anyone experiencing this issue on CPython in macOS should not need to do anything other than upgrade their pip. No magic incantations required unless you're doing something unusual, in which case there is an installation section in our docs that explains how to do this. Since this issue keeps attracting me toos I'm going to lock this so this comment is the last one and hopefully lead people to the simpler solution 😄 |
The simple
pip install cryptography
command does not work on OS X (only tested on El Capitan).What I tried:
results in
The following workaround helped:
The text was updated successfully, but these errors were encountered: