Installing Cryptography (cffi) on M1 Mac

2021-12-11 20:09 (3 years ago) ytyng

When trying to install dependencies with Pipenv

[pipenv.exceptions.InstallError]: running build_ext
[pipenv.exceptions.InstallError]: building '_cffi_backend' extension
[pipenv.exceptions.InstallError]: creating build/temp.macosx-10.14-arm64-3.8
[pipenv.exceptions.InstallError]: creating build/temp.macosx-10.14-arm64-3.8/c
[pipenv.exceptions.InstallError]: clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/opt/homebrew/include -I/opt/homebrew/opt/openssl/include -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi -I/Users/ytyng/workspace/ytyng-blog/.venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c c/_cffi_backend.c -o build/temp.macosx-10.14-arm64-3.8/c/_cffi_backend.o
[pipenv.exceptions.InstallError]: c/_cffi_backend.c:5854:2: error: Apple Arm64 ABI requires ffi_prep_cif_var
[pipenv.exceptions.InstallError]: #error Apple Arm64 ABI requires ffi_prep_cif_var
[pipenv.exceptions.InstallError]: ^
[pipenv.exceptions.InstallError]: c/_cffi_backend.c:6304:9: error: implicit declaration of function 'ffi_prep_closure' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
[pipenv.exceptions.InstallError]: if (ffi_prep_closure(closure, &cif_descr->cif,
[pipenv.exceptions.InstallError]: ^
[pipenv.exceptions.InstallError]: 2 errors generated.
[pipenv.exceptions.InstallError]: error: command 'clang' failed with exit status 1
[pipenv.exceptions.InstallError]: ----------------------------------------
[pipenv.exceptions.InstallError]: ERROR: Command errored out with exit status 1: /Users/ytyng/workspace/ytyng-blog/.venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/h2/rl5s4kl5763gtb1bz7fxg0m80000gn/T/pip-install-9zuwn3fi/cffi_392525a718154d91adb0ac1a457c368c/setup.py'"'"'; __file__='"'"'/private/var/folders/h2/rl5s4kl5763gtb1bz7fxg0m80000gn/T/pip-install-9zuwn3fi/cffi_392525a718154d91adb0ac1a457c368c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/h2/rl5s4kl5763gtb1bz7fxg0m80000gn/T/pip-record-zgqqq7w_/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ytyng/workspace/ytyng-blog/.venv/include/site/python3.8/cffi Check the logs for full command output.

If such an error occurs

LDFLAGS="-L$(brew --prefix openssl@1.1)/lib" CFLAGS="-I$(brew --prefix openssl@1.1)/include" python3 -m pip install cryptography

https://stackoverflow.com/questions/66035003/installing-cryptography-on-an-apple-silicon-m1-mac

Current rating: 1
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Comments

Archive

2025
2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011