question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot pip install numpy on mac M1

See original GitHub issue

Cannot 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:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

33reactions
sbassicommented, Jan 22, 2022

One year later still can’t compile Numpy on M1?

I got this:

Collecting matplotlib==3.4.2
  Downloading matplotlib-3.4.2.tar.gz (37.3 MB)
     |████████████████████████████████| 37.3 MB 907 kB/s 
    ERROR: Command errored out with exit status 1:
     command: /Users/sb/venvs/loambioweb/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qz/kww4c4nx2q71dzf_gzmp3bkc0000gn/T/pip-install-d40pdmke/matplotlib/setup.py'"'"'; __file__='"'"'/private/var/folders/qz/kww4c4nx2q71dzf_gzmp3bkc0000gn/T/pip-install-d40pdmke/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/qz/kww4c4nx2q71dzf_gzmp3bkc0000gn/T/pip-pip-egg-info-b8dja3m9
         cwd: /private/var/folders/qz/kww4c4nx2q71dzf_gzmp3bkc0000gn/T/pip-install-d40pdmke/matplotlib/
    Complete output (1350 lines):
      ERROR: Command errored out with exit status 1:
       command: /Users/sb/venvs/loambioweb/bin/python3 /Users/sb/venvs/loambioweb/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/qz/kww4c4nx2q71dzf_gzmp3bkc0000gn/T/tmpdg8gpnty
           cwd: /private/var/folders/qz/kww4c4nx2q71dzf_gzmp3bkc0000gn/T/pip-wheel-zucxmb5w/numpy
      Complete output (1302 lines):
      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
      INFO: blas_opt_info:
      INFO: blas_armpl_info:
      INFO: customize UnixCCompiler
      INFO:   libraries armpl_lp64_mp not found in ['/Users/sb/venvs/loambioweb/lib', '/usr/lib']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: blas_mkl_info:
      INFO:   libraries mkl_rt not found in ['/Users/sb/venvs/loambioweb/lib', '/usr/lib']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: blis_info:
      INFO:   libraries blis not found in ['/Users/sb/venvs/loambioweb/lib', '/usr/lib']
      INFO:   NOT AVAILABLE
      INFO:
      INFO: openblas_info:
      INFO:   libraries openblas not found in ['/Users/sb/venvs/loambioweb/lib', '/usr/lib']
      INFO:   NOT AVAILABLE
...
4reactions
JoshuaSchlichtingcommented, Apr 11, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python 3.x - numpy build fail in M1 Big sur 11.1 - Stack Overflow
I have tested it on my M1 with Python 3.9.2, macOS Big Sur (11.5.1), and pip 21.1.3. Just use pip/pip3 to install it....
Read more >
Error installing numpy on m1 Mac using terminal - Python
Quit terminal · Find terminal app icon via finder · Right-click the terminal icon > get info > open using Rossetta · Restart...
Read more >
How to install Numpy and Pandas for data science in a M1 ...
Source: Original StackOverflow thread. How to install Pandas in a M1 MacBook: python3 -m pip install virtualenv virtualenv -p python3.8 venv ...
Read more >
Could not build wheels for numpy which use PEP 517 and ...
PyCharm Comm (M1 Mac) - ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly. I can...
Read more >
How To Install NumPy On A Mac - YouTube
In this Python video I am going to show you How to Install numpy Package or How to use PyCharm for installing and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found