Cannot pip install numpy on mac M1
See original GitHub issueCannot pip install numpy.
Reproducing code example:
python -m pip install numpy
Error message:
Collecting numpy Using cached numpy-1.19.5.zip (7.3 MB) Installing build dependencies … done Getting requirements to build wheel … done Preparing wheel metadata … error ERROR: Command errored out with exit status 1: command: /Users/jeffstewart/maroon-bells/venv/bin/python /Users/jeffstewart/maroon-bells/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/tmpvko_1s0y cwd: /private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-install-cgcf8n0u/numpy_f7d15ee151114f0aa52d02ed62f75e3c Complete output (185 lines): Running from numpy source directory. setup.py:480: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates run_build = parse_setuppy_commands() Processing numpy/random/_bounded_integers.pxd.in Processing numpy/random/_philox.pyx Processing numpy/random/_bounded_integers.pyx.in Processing numpy/random/_sfc64.pyx Processing numpy/random/_mt19937.pyx Processing numpy/random/bit_generator.pyx Processing numpy/random/mtrand.pyx Processing numpy/random/_generator.pyx Processing numpy/random/_pcg64.pyx Processing numpy/random/_common.pyx Cythonizing sources blas_opt_info: blas_mkl_info: customize UnixCCompiler libraries mkl_rt not found in [‘/Users/jeffstewart/maroon-bells/venv/lib’, ‘/usr/local/lib’, ‘/usr/lib’] NOT AVAILABLE
blis_info:
libraries blis not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
openblas_info:
libraries openblas not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
libraries tatlas not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_3_10_blas_info:
libraries satlas not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_blas_info:
libraries f77blas,cblas,atlas not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
accelerate_info:
libraries accelerate not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
Library accelerate was not found. Ignoring
libraries veclib not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
Library veclib was not found. Ignoring
FOUND:
extra_compile_args = ['-faltivec', '-I/System/Library/Frameworks/vecLib.framework/Headers']
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
FOUND:
extra_compile_args = ['-faltivec', '-I/System/Library/Frameworks/vecLib.framework/Headers']
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
non-existing path in 'numpy/distutils': 'site.cfg'
lapack_opt_info:
lapack_mkl_info:
libraries mkl_rt not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
openblas_lapack_info:
libraries openblas not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
openblas_clapack_info:
libraries openblas,lapack not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
flame_info:
libraries flame not found in ['/Users/jeffstewart/maroon-bells/venv/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in /Users/jeffstewart/maroon-bells/venv/lib
libraries tatlas,tatlas not found in /Users/jeffstewart/maroon-bells/venv/lib
libraries lapack_atlas not found in /usr/local/lib
libraries tatlas,tatlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries tatlas,tatlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
libraries lapack_atlas not found in /Users/jeffstewart/maroon-bells/venv/lib
libraries satlas,satlas not found in /Users/jeffstewart/maroon-bells/venv/lib
libraries lapack_atlas not found in /usr/local/lib
libraries satlas,satlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries satlas,satlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in /Users/jeffstewart/maroon-bells/venv/lib
libraries ptf77blas,ptcblas,atlas not found in /Users/jeffstewart/maroon-bells/venv/lib
libraries lapack_atlas not found in /usr/local/lib
libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries ptf77blas,ptcblas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
libraries lapack_atlas not found in /Users/jeffstewart/maroon-bells/venv/lib
libraries f77blas,cblas,atlas not found in /Users/jeffstewart/maroon-bells/venv/lib
libraries lapack_atlas not found in /usr/local/lib
libraries f77blas,cblas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries f77blas,cblas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
FOUND:
extra_compile_args = ['-faltivec', '-I/System/Library/Frameworks/vecLib.framework/Headers']
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
/Users/jeffstewart/.pyenv/versions/3.9.1/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
running dist_info
running build_src
build_src
building py_modules sources
creating build
creating build/src.macosx-11.1-arm64-3.9
creating build/src.macosx-11.1-arm64-3.9/numpy
creating build/src.macosx-11.1-arm64-3.9/numpy/distutils
building library "npymath" sources
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Traceback (most recent call last):
File "/Users/jeffstewart/maroon-bells/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/Users/jeffstewart/maroon-bells/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/jeffstewart/maroon-bells/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-build-env-98_m8bsv/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 157, in prepare_metadata_for_build_wheel
self.run_setup()
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-build-env-98_m8bsv/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 248, in run_setup
super(_BuildMetaLegacyBackend,
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-build-env-98_m8bsv/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 508, in <module>
setup_package()
File "setup.py", line 500, in setup_package
setup(**metadata)
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-install-cgcf8n0u/numpy_f7d15ee151114f0aa52d02ed62f75e3c/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-build-env-98_m8bsv/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "/Users/jeffstewart/.pyenv/versions/3.9.1/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Users/jeffstewart/.pyenv/versions/3.9.1/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Users/jeffstewart/.pyenv/versions/3.9.1/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-build-env-98_m8bsv/overlay/lib/python3.9/site-packages/setuptools/command/dist_info.py", line 31, in run
egg_info.run()
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-install-cgcf8n0u/numpy_f7d15ee151114f0aa52d02ed62f75e3c/numpy/distutils/command/egg_info.py", line 24, in run
self.run_command("build_src")
File "/Users/jeffstewart/.pyenv/versions/3.9.1/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/jeffstewart/.pyenv/versions/3.9.1/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-install-cgcf8n0u/numpy_f7d15ee151114f0aa52d02ed62f75e3c/numpy/distutils/command/build_src.py", line 144, in run
self.build_sources()
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-install-cgcf8n0u/numpy_f7d15ee151114f0aa52d02ed62f75e3c/numpy/distutils/command/build_src.py", line 155, in build_sources
self.build_library_sources(*libname_info)
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-install-cgcf8n0u/numpy_f7d15ee151114f0aa52d02ed62f75e3c/numpy/distutils/command/build_src.py", line 288, in build_library_sources
sources = self.generate_sources(sources, (lib_name, build_info))
File "/private/var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/pip-install-cgcf8n0u/numpy_f7d15ee151114f0aa52d02ed62f75e3c/numpy/distutils/command/build_src.py", line 378, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 663, in get_mathlib_info
raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/jeffstewart/maroon-bells/venv/bin/python /Users/jeffstewart/maroon-bells/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/6q/jk0p94b12x713m1c02tyt1fc0000gn/T/tmpvko_1s0y Check the logs for full command output.
NumPy/Python version information:
Numpy version 1.19.5 Python version 3.9.1 macOS Big Sur 11.1 (Apple Silicon)
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
One year later still can’t compile Numpy on M1?
I got this:
If any future M1 users come across this, but their error was related to installing in docker, they can try adding the following argument to your
docker build
command:--platform linux/amd64
This resolved my issue with this error when using Docker.