Skip to content

BUG: can't compile on latest MacOS (M1) #27863

@xor2k

Description

@xor2k

Describe the issue:

Among others, I'm using MacOS 15.1.1. on a MacBook M1. I followed the instructions on

https://numpy.org/devdocs/building/

Error message see below. Looks like the compiler is misconfigured or so. The line that triggers the bug is

pip install numpy --no-binary numpy

It tries to install numpy-2.1.3.tar.gz. Same problem occurs with the most recent commit 4e8f724fbc136b1bac1c43e24d189ebc45e056eb

Reproduce the code example:

pip install numpy --no-binary numpy

Error message:

Collecting numpy
  Using cached numpy-2.1.3.tar.gz (20.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [294 lines of output]
      + /Users/michael/miniforge3/envs/numpy_dev/bin/python3.12 /private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4/vendored-meson/meson/meson.py setup /private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4 /private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4/.mesonpy-47vgr2n9 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4/.mesonpy-47vgr2n9/meson-python-native-file.ini
      The Meson build system
      Version: 1.5.2
      Source dir: /private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4
      Build dir: /private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4/.mesonpy-47vgr2n9
      Build type: native build
      Project name: NumPy
      Project version: 2.1.3
      C compiler for the host machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.4)")
      C linker for the host machine: cc ld64 1115.7.3
      C++ compiler for the host machine: c++ (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.4)")
      C++ linker for the host machine: c++ ld64 1115.7.3
      Cython compiler for the host machine: cython (cython 3.0.11)
      Host machine cpu family: aarch64
      Host machine cpu: aarch64
      Program python found: YES (/Users/michael/miniforge3/envs/numpy_dev/bin/python3.12)
      Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 2.3.0
      Run-time dependency python found: YES 3.12
      Has header "Python.h" with dependency python-3.12: YES
      Compiler for C supports arguments -fno-strict-aliasing: YES
      Compiler for C supports arguments -ftrapping-math: YES
      Compiler for C supports link arguments -Wl,-ld_classic: YES
      Message: During parsing cpu-dispatch: The following CPU features were ignored due to platform incompatibility or lack of support:
      "XOP FMA4"
      Test features "NEON NEON_FP16 NEON_VFPV4 ASIMD" : Supported
      Test features "ASIMDHP" : Supported
      Test features "ASIMDFHM" : Supported
      Test features "SVE" : Unsupported due to Compiler fails against the test code of "SVE"
      Configuring npy_cpu_dispatch_config.h using configuration
      Message:
      CPU Optimization Options
        baseline:
          Requested : min
          Enabled   : NEON NEON_FP16 NEON_VFPV4 ASIMD
        dispatch:
          Requested : max -xop -fma4
          Enabled   : ASIMDHP ASIMDFHM
      
      Library m found: YES
      Run-time dependency scipy-openblas found: NO (tried pkgconfig)
      Run-time dependency accelerate found: YES
      ../numpy/meson.build:135: WARNING: Project targets '>=1.2.99' but uses feature introduced in '1.3.0': dep 'accelerate' custom lookup.
      Message: BLAS symbol suffix: $NEWLAPACK
      Checking if "Check atomic builtins without -latomic" : links: NO
      Library atomic found: NO
      Program _build_utils/process_src_template.py found: YES (/Users/michael/miniforge3/envs/numpy_dev/bin/python3.12 /private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4/numpy/_build_utils/process_src_template.py)
      Program _build_utils/tempita.py found: YES (/Users/michael/miniforge3/envs/numpy_dev/bin/python3.12 /private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4/numpy/_build_utils/tempita.py)
      Configuring __config__.py using configuration
      Checking for size of "short" : 2
      Checking for size of "int" : 4
      Checking for size of "long" : 8
      Checking for size of "long long" : 8
      Checking for size of "float" : 4
      Checking for size of "double" : 8
      Checking for size of "long double" : 8
      Checking for size of "size_t" : 8
      Checking for size of "size_t" : 8 (cached)
      Checking for size of "wchar_t" : 4
      Checking for size of "off_t" : 8
      Checking for size of "Py_intptr_t" with dependency python-3.12: 8
      Checking for size of "PY_LONG_LONG" with dependency python-3.12: 8
      Has header "complex.h" : YES
      Checking for type "complex float" : YES
      Checking for size of "complex float" : 8
      Checking for type "complex double" : YES
      Checking for size of "complex double" : 16
      Checking for type "complex long double" : YES
      Checking for size of "complex long double" : 16
      Checking for function "sin" with dependency -lm: YES
      Checking for function "cos" with dependency -lm: YES
      Checking for function "tan" with dependency -lm: YES
      Checking for function "sinh" with dependency -lm: YES
      Checking for function "cosh" with dependency -lm: YES
      Checking for function "tanh" with dependency -lm: YES
      Checking for function "fabs" with dependency -lm: YES
      Checking for function "floor" with dependency -lm: YES
      Checking for function "ceil" with dependency -lm: YES
      Checking for function "sqrt" with dependency -lm: YES
      Checking for function "log10" with dependency -lm: YES
      Checking for function "log" with dependency -lm: YES
      Checking for function "exp" with dependency -lm: YES
      Checking for function "asin" with dependency -lm: YES
      Checking for function "acos" with dependency -lm: YES
      Checking for function "atan" with dependency -lm: YES
      Checking for function "fmod" with dependency -lm: YES
      Checking for function "modf" with dependency -lm: YES
      Checking for function "frexp" with dependency -lm: YES
      Checking for function "ldexp" with dependency -lm: YES
      Checking for function "expm1" with dependency -lm: YES
      Checking for function "log1p" with dependency -lm: YES
      Checking for function "acosh" with dependency -lm: YES
      Checking for function "asinh" with dependency -lm: YES
      Checking for function "atanh" with dependency -lm: YES
      Checking for function "rint" with dependency -lm: YES
      Checking for function "trunc" with dependency -lm: YES
      Checking for function "exp2" with dependency -lm: YES
      Checking for function "copysign" with dependency -lm: YES
      Checking for function "nextafter" with dependency -lm: YES
      Checking for function "cbrt" with dependency -lm: YES
      Checking for function "log2" with dependency -lm: YES
      Checking for function "pow" with dependency -lm: YES
      Checking for function "hypot" with dependency -lm: YES
      Checking for function "atan2" with dependency -lm: YES
      Checking for function "csin" with dependency -lm: YES
      Checking for function "csinh" with dependency -lm: YES
      Checking for function "ccos" with dependency -lm: YES
      Checking for function "ccosh" with dependency -lm: YES
      Checking for function "ctan" with dependency -lm: YES
      Checking for function "ctanh" with dependency -lm: YES
      Checking for function "creal" with dependency -lm: YES
      Checking for function "cimag" with dependency -lm: YES
      Checking for function "conj" with dependency -lm: YES
      Checking for function "strtoll" : YES
      Checking for function "strtoull" : YES
      Checking for function "cabs" with dependency -lm: YES
      Checking for function "cabsf" with dependency -lm: YES
      Checking for function "cabsl" with dependency -lm: YES
      Checking for function "cacos" with dependency -lm: YES
      Checking for function "cacosf" with dependency -lm: YES
      Checking for function "cacosl" with dependency -lm: YES
      Checking for function "cacosh" with dependency -lm: YES
      Checking for function "cacoshf" with dependency -lm: YES
      Checking for function "cacoshl" with dependency -lm: YES
      Checking for function "carg" with dependency -lm: YES
      Checking for function "cargf" with dependency -lm: YES
      Checking for function "cargl" with dependency -lm: YES
      Checking for function "casin" with dependency -lm: YES
      Checking for function "casinf" with dependency -lm: YES
      Checking for function "casinl" with dependency -lm: YES
      Checking for function "casinh" with dependency -lm: YES
      Checking for function "casinhf" with dependency -lm: YES
      Checking for function "casinhl" with dependency -lm: YES
      Checking for function "catan" with dependency -lm: YES
      Checking for function "catanf" with dependency -lm: YES
      Checking for function "catanl" with dependency -lm: YES
      Checking for function "catanh" with dependency -lm: YES
      Checking for function "catanhf" with dependency -lm: YES
      Checking for function "catanhl" with dependency -lm: YES
      Checking for function "cexp" with dependency -lm: YES
      Checking for function "cexpf" with dependency -lm: YES
      Checking for function "cexpl" with dependency -lm: YES
      Checking for function "clog" with dependency -lm: YES
      Checking for function "clogf" with dependency -lm: YES
      Checking for function "clogl" with dependency -lm: YES
      Checking for function "cpow" with dependency -lm: YES
      Checking for function "cpowf" with dependency -lm: YES
      Checking for function "cpowl" with dependency -lm: YES
      Checking for function "csqrt" with dependency -lm: YES
      Checking for function "csqrtf" with dependency -lm: YES
      Checking for function "csqrtl" with dependency -lm: YES
      Checking for function "csin" with dependency -lm: YES (cached)
      Checking for function "csinf" with dependency -lm: YES
      Checking for function "csinl" with dependency -lm: YES
      Checking for function "csinh" with dependency -lm: YES (cached)
      Checking for function "csinhf" with dependency -lm: YES
      Checking for function "csinhl" with dependency -lm: YES
      Checking for function "ccos" with dependency -lm: YES (cached)
      Checking for function "ccosf" with dependency -lm: YES
      Checking for function "ccosl" with dependency -lm: YES
      Checking for function "ccosh" with dependency -lm: YES (cached)
      Checking for function "ccoshf" with dependency -lm: YES
      Checking for function "ccoshl" with dependency -lm: YES
      Checking for function "ctan" with dependency -lm: YES (cached)
      Checking for function "ctanf" with dependency -lm: YES
      Checking for function "ctanl" with dependency -lm: YES
      Checking for function "ctanh" with dependency -lm: YES (cached)
      Checking for function "ctanhf" with dependency -lm: YES
      Checking for function "ctanhl" with dependency -lm: YES
      Checking for function "isfinite" with dependency -lm: YES
      Header "Python.h" has symbol "isfinite" with dependency python-3.12: YES
      Checking for function "isinf" with dependency -lm: YES
      Header "Python.h" has symbol "isinf" with dependency python-3.12: YES
      Checking for function "isnan" with dependency -lm: YES
      Header "Python.h" has symbol "isnan" with dependency python-3.12: YES
      Checking for function "signbit" with dependency -lm: YES
      Header "Python.h" has symbol "signbit" with dependency python-3.12: YES
      Checking if "thread_local" compiles: NO
      Checking if "_Thread_local" compiles: YES
      Checking if "__thread" compiles: YES
      Checking if "__declspec(thread)" compiles: NO
      Checking for function "fallocate" : NO
      Header "Python.h" has symbol "HAVE_FTELLO" with dependency python-3.12: YES
      Header "Python.h" has symbol "HAVE_FSEEKO" with dependency python-3.12: YES
      Checking for function "backtrace" : YES
      Checking for function "madvise" : YES
      Has header "features.h" : NO
      Has header "xlocale.h" : YES
      Has header "dlfcn.h" : YES
      Has header "execinfo.h" : YES
      Has header "libunwind.h" : YES
      Has header "sys/mman.h" : YES
      Checking for function "strtold_l" : YES
      Compiler for C supports arguments -O3: YES
      Has header "endian.h" : NO
      Has header "sys/endian.h" : NO
      Compiler for C supports function attribute visibility:hidden: YES
      Configuring config.h using configuration
      Configuring _numpyconfig.h using configuration
      Configuring npymath.ini using configuration
      Configuring mlib.ini using configuration
      Configuring numpy.pc using configuration
      Generating multi-targets for "_umath_tests.dispatch.h"
        Enabled targets: ASIMDHP, baseline
      Generating multi-targets for "argfunc.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "x86_simd_argsort.dispatch.h"
        Enabled targets:
      Generating multi-targets for "x86_simd_qsort.dispatch.h"
        Enabled targets:
      Generating multi-targets for "x86_simd_qsort_16bit.dispatch.h"
        Enabled targets:
      Generating multi-targets for "highway_qsort.dispatch.h"
        Enabled targets: ASIMD
      Generating multi-targets for "highway_qsort_16bit.dispatch.h"
        Enabled targets: ASIMDHP
      Generating multi-targets for "loops_arithm_fp.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_arithmetic.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_comparison.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_exponent_log.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_hyperbolic.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_logical.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_minmax.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_modulo.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_trigonometric.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_umath_fp.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_unary.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_unary_fp.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_unary_fp_le.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_unary_complex.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "loops_autovec.dispatch.h"
        Enabled targets: baseline
      Generating multi-targets for "_simd.dispatch.h"
        Enabled targets: baseline
      Build targets in project: 63
      WARNING: Project specifies a minimum meson_version '>=1.2.99' but uses features which were added in newer versions:
       * 1.3.0: {'dep 'accelerate' custom lookup'}
      
      NumPy 2.1.3
      
        User defined options
          Native files: /private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4/.mesonpy-47vgr2n9/meson-python-native-file.ini
          buildtype   : release
          b_ndebug    : if-release
          b_vscrt     : md
      
      Found ninja-1.11.1.git.kitware.jobserver-1 at /private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-build-env-z5sgx1sv/normal/bin/ninja
      + /private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-build-env-z5sgx1sv/normal/bin/ninja
      [1/320] Generating numpy/_core/npy_math_internal.h with a custom command
      [2/320] Generating 'numpy/_core/libnpymath.a.p/npy_math_complex.c'
      [3/320] Generating 'numpy/_core/libnpymath.a.p/ieee754.c'
      [4/320] Copying file numpy/__init__.pxd
      [5/320] Copying file numpy/__init__.py
      [6/320] Generating numpy/_core/_umath_doc_generated with a custom command
      [7/320] Copying file numpy/__init__.cython-30.pxd
      [8/320] Generating numpy/_core/__umath_generated with a custom command
      [9/320] Compiling C++ object numpy/_core/libhighway.a.p/src_highway_hwy_abort.cc.o
      FAILED: numpy/_core/libhighway.a.p/src_highway_hwy_abort.cc.o
      c++ -Inumpy/_core/libhighway.a.p -Inumpy/_core -I../numpy/_core -I../numpy/_core/src/highway -I/private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4/.mesonpy-47vgr2n9/meson_cpu -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c++17 -O3 -ftrapping-math -DNPY_HAVE_CLANG_FPSTRICT -DNPY_HAVE_NEON_VFPV4 -DNPY_HAVE_NEON_FP16 -DNPY_HAVE_NEON -DNPY_HAVE_ASIMD -DTOOLCHAIN_MISS_ASM_HWCAP_H -MD -MQ numpy/_core/libhighway.a.p/src_highway_hwy_abort.cc.o -MF numpy/_core/libhighway.a.p/src_highway_hwy_abort.cc.o.d -o numpy/_core/libhighway.a.p/src_highway_hwy_abort.cc.o -c ../numpy/_core/src/highway/hwy/abort.cc
      ../numpy/_core/src/highway/hwy/abort.cc:12:10: fatal error: 'string' file not found
         12 | #include <string>
            |          ^~~~~~~~
      1 error generated.
      [10/320] Generating 'numpy/_core/_multiarray_tests.cpython-312-darwin.so.p/_multiarray_tests.c'
      [11/320] Generating 'numpy/_core/_multiarray_tests.cpython-312-darwin.so.p/templ_common.h'
      [12/320] Generating 'numpy/_core/_umath_tests.cpython-312-darwin.so.p/_umath_tests.c'
      [13/320] Generating numpy/_core/__ufunc_api with a custom command
      [14/320] Compiling C object numpy/_core/libnpymath.a.p/meson-generated_ieee754.c.o
      [15/320] Generating numpy/_core/__multiarray_api with a custom command
      [16/320] Compiling C++ object numpy/_core/libnpymath.a.p/src_npymath_halffloat.cpp.o
      FAILED: numpy/_core/libnpymath.a.p/src_npymath_halffloat.cpp.o
      c++ -Inumpy/_core/libnpymath.a.p -Inumpy/_core -I../numpy/_core -Inumpy/_core/include -I../numpy/_core/include -I../numpy/_core/src/npymath -I../numpy/_core/src/common -I/Users/michael/miniforge3/envs/numpy_dev/include/python3.12 -I/private/var/folders/y6/t2cjhdld4592pkfkyhlp2q0h0000gn/T/pip-install-ntunmvpr/numpy_26c84bb9c85c4ed3b7e3476a5bae71d4/.mesonpy-47vgr2n9/meson_cpu -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c++17 -O3 -ftrapping-math -DNPY_HAVE_CLANG_FPSTRICT -DNPY_HAVE_NEON_VFPV4 -DNPY_HAVE_NEON_FP16 -DNPY_HAVE_NEON -DNPY_HAVE_ASIMD -MD -MQ numpy/_core/libnpymath.a.p/src_npymath_halffloat.cpp.o -MF numpy/_core/libnpymath.a.p/src_npymath_halffloat.cpp.o.d -o numpy/_core/libnpymath.a.p/src_npymath_halffloat.cpp.o -c ../numpy/_core/src/npymath/halffloat.cpp
      In file included from ../numpy/_core/src/npymath/halffloat.cpp:12:
      In file included from ../numpy/_core/src/common/common.hpp:8:
      ../numpy/_core/src/common/utils.hpp:10:10: fatal error: 'type_traits' file not found
         10 | #include <type_traits>
            |          ^~~~~~~~~~~~~
      1 error generated.
      [17/320] Compiling C object numpy/_core/libnpymath.a.p/meson-generated_npy_math_complex.c.o
      [18/320] Compiling C object numpy/_core/libnpymath.a.p/src_npymath_npy_math.c.o
      ninja: build stopped: subcommand failed.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Python and NumPy Versions:

3.12.7 | packaged by conda-forge | (main, Oct 4 2024, 15:57:01) [Clang 17.0.6 ]

numpy can't be installed

Runtime Environment:

No response

Context for the issue:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions