Unable to install llvmlite in pip on Apple Silicon Mac (M1)
See original GitHub issueI’m having problems installing llvmlite from pip on MacOS Big Sur. The installation breaks on this check: clang-9: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11'. I checked with clang --version and I actually have clang 12.0 installed right now, but I think llvmlite uses its own custom clang++ based on version 9. But surely there is a way to get it to compile on Big Sur/M1 hardware? I tried running pip with arch -x86_64 prefix but it didn’t make any difference. I also tried installing ==0.33 to try an older version but got the same error message.
Can anyone help me solve this problem?
[ilya:/opt/homebrew] 1 % pip install --platform macosx_10_9_x86_64 --target=/tmp numba
ERROR: When restricting platform and interpreter constraints using --python-version, --platform, --abi, or --implementation, either --no-deps must be set, or --only-binary=:all: must be set and --no-binary must not be set (or must be set to :none:).
[ilya:/opt/homebrew] 1 % pip install llvmlite
Collecting llvmlite
Using cached llvmlite-0.35.0.tar.gz (121 kB)
Building wheels for collected packages: llvmlite
Building wheel for llvmlite (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python@3.9/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/0p/y9v6h7xd3tgdp8cg8_5649n40000gn/T/pip-install-bulqlmh_/llvmlite_8af07074863e432eb5155a54d00bd44b/setup.py'"'"'; __file__='"'"'/private/var/folders/0p/y9v6h7xd3tgdp8cg8_5649n40000gn/T/pip-install-bulqlmh_/llvmlite_8af07074863e432eb5155a54d00bd44b/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/0p/y9v6h7xd3tgdp8cg8_5649n40000gn/T/pip-wheel-chloq3u1
cwd: /private/var/folders/0p/y9v6h7xd3tgdp8cg8_5649n40000gn/T/pip-install-bulqlmh_/llvmlite_8af07074863e432eb5155a54d00bd44b/
Complete output (19 lines):
running bdist_wheel
/usr/local/opt/python@3.9/bin/python3.9 /private/var/folders/0p/y9v6h7xd3tgdp8cg8_5649n40000gn/T/pip-install-bulqlmh_/llvmlite_8af07074863e432eb5155a54d00bd44b/ffi/build.py
LLVM version... MACOSX_DEPLOYMENT_TARGET=11 clang++ -std=c++11 -stdlib=libc++ -dynamiclib -I/usr/local/Cellar/llvm@9/9.0.1_2/include -std=c++11 -stdlib=libc++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -g assembly.cpp bitcode.cpp core.cpp initfini.cpp module.cpp value.cpp executionengine.cpp transforms.cpp passmanagers.cpp targets.cpp dylib.cpp linker.cpp object_file.cpp custom_passes.cpp -o libllvmlite.dylib -L/usr/local/Cellar/llvm@9/9.0.1_2/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVMXRay -lLLVMWindowsManifest -lLLVMTextAPI -lLLVMTableGen -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMOrcJIT -lLLVMJITLink -lLLVMObjectYAML -lLLVMMCA -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMLineEditor -lLLVMLibDriver -lLLVMInterpreter -lLLVMFuzzMutate -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMDlltoolDriver -lLLVMOption -lLLVMDebugInfoGSYM -lLLVMCoverage -lLLVMCoroutines -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Utils -lLLVMX86Info -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyInfo -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVDisassembler -lLLVMRISCVCodeGen -lLLVMRISCVAsmParser -lLLVMRISCVDesc -lLLVMRISCVUtils -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430CodeGen -lLLVMMSP430AsmParser -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFCodeGen -lLLVMBPFAsmParser -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMMIRParser -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMAArch64Disassembler -lLLVMMCDisassembler -lLLVMAArch64CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoDWARF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMBitReader -lLLVMBitstreamReader -lLLVMCore -lLLVMRemarks -lLLVMAArch64AsmParser -lLLVMMCParser -lLLVMAArch64Desc -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBinaryFormat -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMSupport -lLLVMDemangle -lz -lcurses -lm -lxml2
clang-9: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11'
make: *** [all] Error 1
9.0.1
SVML not detected
Traceback (most recent call last):
File "/private/var/folders/0p/y9v6h7xd3tgdp8cg8_5649n40000gn/T/pip-install-bulqlmh_/llvmlite_8af07074863e432eb5155a54d00bd44b/ffi/build.py", line 191, in <module>
main()
File "/private/var/folders/0p/y9v6h7xd3tgdp8cg8_5649n40000gn/T/pip-install-bulqlmh_/llvmlite_8af07074863e432eb5155a54d00bd44b/ffi/build.py", line 185, in main
main_posix('osx', '.dylib')
File "/private/var/folders/0p/y9v6h7xd3tgdp8cg8_5649n40000gn/T/pip-install-bulqlmh_/llvmlite_8af07074863e432eb5155a54d00bd44b/ffi/build.py", line 173, in main_posix
subprocess.check_call(['make', '-f', makefile])
File "/usr/local/Cellar/python@3.9/3.9.0_5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-f', 'Makefile.osx']' returned non-zero exit status 2.
error: command '/usr/local/opt/python@3.9/bin/python3.9' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for llvmlite
Running setup.py clean for llvmlite
Failed to build llvmlite
Issue Analytics
- State:
- Created 3 years ago
- Reactions:21
- Comments:54 (20 by maintainers)
Top Results From Across the Web
M1 Mac how to install llvm - Stack Overflow
I was able to install llvmlite on my m1 with the following steps: arch -arm64 brew install llvm@11 ...
Read more >Installation — llvmlite 0.40.0dev0-48-ged0f625-dirty ...
This will inevitably fail as the llvmlite source distribution needs an appropriate LLVM installation to build. If you are using pip < 19.0...
Read more >Unable to install llvmlite in pip on Apple Silicon Mac (M1)
I'm having problems installing llvmlite from pip on MacOS Big Sur. The installation breaks on this check: clang-9: error: invalid version ...
Read more >Numba 0.53.0 and llvmlite 0.36.0 final release - Announcements
Wheels are in the usual place, and conda packages are in the numba channel: conda install -c numba numba=0.53.0 conda install -c numba...
Read more >llvmlite - PyPI
pip install llvmlite ... llvmlite is a project originally tailored for Numba's needs, using the following ... conda install --channel=numba llvmlite.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I was able to install llvmlite with pipenv on an m1 with the following steps:
arch -arm64 brew install llvm@11LLVM_CONFIG="/opt/homebrew/Cellar/llvm@11/11.1.0_2/bin/llvm-config" arch -arm64 pipenv install llvmliteIt’s important to:
brew install llvmwill get you version 12, and llvmlite specifically calls this out as a compatibility error).arch.LLVM_CONFIGvalue is correct for your system (homebrew has recently changed where it puts things).@thatandromeda 's workaround worked for me but I had to update the config path with
/11.1.0_3/and use my homebrew installed python instead: