AMICI-dev/AMICI

Not installing on Mac M1

Closed this issue · 4 comments

Dear AMICI Team,

I have encountered an issue while installing AMICI on my Mac M1 with Anaconda. I have followed the documentation verbatim and have arrived to an architecture error. Both pip install amici and CFLAGS="-stdlib=libc++" CC=clang CXX=clang pip3 install --verbose amici gives similar errors. Could anyone help me to look into this?

OS Details:

% uname -a
Darwin de-aaguilar 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:41 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8103 arm64

Hardware Overview:

Model Name: MacBook Air
Model Identifier: MacBookAir10,1
Chip: Apple M1
Total Number of Cores: 8 (4 performance and 4 efficiency)
Memory: 16 GB
System Firmware Version: 10151.101.3
OS Loader Version: 10151.101.3
Serial Number (system): FVFHW11PQ6LR

Python Version:

% python -V                                                              
Python 3.10.13

The error messages are quite large. Here is the one for CFLAGS="-stdlib=libc++" CC=clang CXX=clang pip3 install --verbose amici on

Let me know if more details are needed

  ------------------------------ amici ------------------------------
  -- The C compiler identification is AppleClang 15.0.0.15000309
  -- The CXX compiler identification is AppleClang 15.0.0.15000309
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/clang - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/clang - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- CMAKE_CURRENT_SOURCE_DIR: /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/amici
  -- CMAKE_BINARY_DIR: /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/temp.macosx-10.9-x86_64-cpython-310_amici
  -- CMAKE_INSTALL_PREFIX: /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici
  -- Performing Test CUR_FLAG_SUPPORTED
  -- Performing Test CUR_FLAG_SUPPORTED - Success
  -- Looking for dgemm_
  -- Looking for dgemm_ - found
  -- Found BLAS: /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/System/Library/Frameworks/Accelerate.framework
  -- Found Apple Accelerate BLAS
  -- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
  -- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
  -- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
  -- Found Boost: /opt/homebrew/lib/cmake/Boost-1.84.0/BoostConfig.cmake (found version "1.84.0") found components: chrono
  -- Found HDF5: hdf5-shared;hdf5_cpp-shared (found version "1.14.3") found components: C HL CXX
  -- Found SUNDIALS: /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/cmake/sundials
  -- HDF5 library found. Building AMICI with HDF5 support.
  -- Found Git: /usr/bin/git (found version "2.39.3 (Apple Git-146)")
  fatal: not a git repository (or any of the parent directories): .git
  -- Found SWIG: /opt/homebrew/bin/swig (found version "4.2.1")
  -- Found Python3: /Users/aaguilar/envs/pkmodels/bin/python (found version "3.10.13") found components: Interpreter Development NumPy Development.Module Development.Embed
  -- Python extension suffix is .cpython-310-darwin.so
  -- Configuring done (18.2s)
  -- Generating done (0.0s)
  -- Build files have been written to: /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/temp.macosx-10.9-x86_64-cpython-310_amici
  Change Dir: '/private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/temp.macosx-10.9-x86_64-cpython-310_amici'

  Run Build Command(s): /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-build-env-zma0591k/overlay/bin/ninja -v -j 1
[...]
  FAILED: swig/_amici.cpython-310-darwin.so
  : && /Library/Developer/CommandLineTools/usr/bin/clang -Wall -O3 -DNDEBUG -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -bundle -Wl,-headerpad_max_install_names  -o swig/_amici.cpython-310-darwin.so swig/CMakeFiles/_amici.dir/CMakeFiles/_amici.dir/amiciPYTHON_wrap.cxx.o  -Wl,-rpath,ThirdParty/SuiteSparse/lib -Wl,-rpath,/Users/aaguilar/envs/pkmodels/lib  libamici.a  /Users/aaguilar/envs/pkmodels/lib/libpython3.10.dylib  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_generic.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_nvecserial.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunlinsolband.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunmatrixband.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunlinsoldense.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunmatrixdense.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunlinsolpcg.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunlinsolspbcgs.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunlinsolspfgmr.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunlinsolspgmr.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunlinsolsptfqmr.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunlinsolklu.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunmatrixsparse.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libklu.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libamd.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libcolamd.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libbtf.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsuitesparseconfig.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunnonlinsolnewton.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_sunnonlinsolfixedpoint.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_cvodes.a  /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-id_8t_x7/amici_9926d9e396994e5bba018212cc3f0eb0/build/lib.macosx-10.9-x86_64-cpython-310/amici/lib/libsundials_idas.a  -lm  /opt/homebrew/lib/libboost_chrono-mt.dylib  -framework Accelerate  /opt/homebrew/lib/libhdf5_hl_cpp.310.0.3.dylib  /opt/homebrew/lib/libhdf5_hl.310.0.3.dylib  /opt/homebrew/lib/libhdf5_cpp.310.0.3.dylib  /opt/homebrew/lib/libhdf5.310.3.0.dylib && :
  ld: warning: ignoring file '/opt/homebrew/Cellar/hdf5/1.14.3_1/lib/libhdf5_cpp.310.0.3.dylib': found architecture 'arm64', required architecture 'x86_64'
  ld: warning: ignoring file '/opt/homebrew/Cellar/hdf5/1.14.3_1/lib/libhdf5_hl_cpp.310.0.3.dylib': found architecture 'arm64', required architecture 'x86_64'
  ld: warning: ignoring file '/opt/homebrew/Cellar/hdf5/1.14.3_1/lib/libhdf5_hl.310.0.3.dylib': found architecture 'arm64', required architecture 'x86_64'
  ld: warning: ignoring file '/opt/homebrew/Cellar/boost/1.84.0_1/lib/libboost_chrono-mt.dylib': found architecture 'arm64', required architecture 'x86_64'
  ld: warning: ignoring file '/opt/homebrew/Cellar/hdf5/1.14.3_1/lib/libhdf5.310.3.0.dylib': found architecture 'arm64', required architecture 'x86_64'
  Undefined symbols for architecture x86_64:
[...]

FYI @matthiaskoenig

Hi @MadNietzsche, the error message you are getting is because cmake is trying to build amici for a x86_64 architecture (wrong) and then runs into issues when linking external libraries that were build for arm64 (correct).

Conda has a pretty bad track record in terms of touching compiler flags it shouldn't touch, so I am guessing that that it's the culprit. Could you try installing amici in a new conda environment created using CONDA_SUBDIR=osx-arm64 conda create?

Hi Fabian - Thank you for your timely reply!

The error has now changed to no matching constructor for initialization of 'amici::IDASolver', while I am getting a warning about tp_print being deprecated. Any ideas?

Changed extra_compile_args for unix to ['-std=c++14']
  building 'amici._amici' extension
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -stdlib=libc++ -DAMICI_SWIG_WITHOUT_HDF5 -Iamici/include -Iamici/ThirdParty/gsl -Iamici/ThirdParty/sundials/include -Iamici/ThirdParty/sundials/src -Iamici/ThirdParty/sundials/src/sundials -Iamici/ThirdParty/SuiteSparse/KLU/Include -Iamici/ThirdParty/SuiteSparse/AMD/Include -Iamici/ThirdParty/SuiteSparse/COLAMD/Include -Iamici/ThirdParty/SuiteSparse/BTF/Include -Iamici/ThirdParty/SuiteSparse/SuiteSparse_config -Iamici/ThirdParty/SuiteSparse/include -Iamici/ThirdParty/SuiteSparse/KLU/Include -Iamici/ThirdParty/SuiteSparse/AMD/Include -Iamici/ThirdParty/SuiteSparse/COLAMD/Include -Iamici/ThirdParty/SuiteSparse/BTF/Include -Iamici/ThirdParty/SuiteSparse/SuiteSparse_config -Iamici/ThirdParty/SuiteSparse/include -I/private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-build-env-81yv9_0w/overlay/lib/python3.8/site-packages/numpy/core/include -I/Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8 -c amici/amici_wrap.cxx -o build/temp.macosx-12.6-arm64-cpython-38/amici/amici_wrap.o -std=c++14
  amici/amici_wrap.cxx:1503:7: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
        0,                                  /* tp_print */
        ^
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
      Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
      ^
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  In file included from amici/amici_wrap.cxx:199:
  In file included from /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/Python.h:85:
  In file included from /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/pytime.h:6:
  In file included from /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/object.h:746:
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/cpython/object.h:177:16: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
  typedef struct _typeobject {
                 ^
  amici/amici_wrap.cxx:1516:18: note: in implicit copy assignment operator for '_typeobject' first required here
      varlink_type = tmp;
                   ^
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
      Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
      ^
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  In file included from amici/amici_wrap.cxx:199:
  In file included from /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/Python.h:85:
  In file included from /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/pytime.h:6:
  In file included from /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/object.h:746:
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/cpython/object.h:177:16: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
  typedef struct _typeobject {
                 ^
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
      Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
      ^
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  amici/amici_wrap.cxx:2133:7: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
        0,                                    /* tp_print */
        ^
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
      Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
      ^
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  amici/amici_wrap.cxx:2349:7: warning: 'tp_print' is deprecated [-Wdeprecated-declarations]
        0,                                    /* tp_print */
        ^
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/cpython/object.h:260:5: note: 'tp_print' has been explicitly marked deprecated here
      Py_DEPRECATED(3.8) int (*tp_print)(PyObject *, FILE *, int);
      ^
  /Users/aaguilar/.pyenv/versions/3.8.14/include/python3.8/pyport.h:515:54: note: expanded from macro 'Py_DEPRECATED'
  #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                       ^
  amici/amici_wrap.cxx:53558:42: error: no matching constructor for initialization of 'amici::IDASolver'
          result = (amici::IDASolver *)new amici::IDASolver((amici::Solver const &)*arg1);
                                           ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  amici/include/amici/solver_idas.h:28:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const amici::Solver' to 'const amici::IDASolver' for 1st argument
  class IDASolver : public Solver {
        ^
  amici/include/amici/solver_idas.h:28:7: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
  amici/amici_wrap.cxx:54731:44: error: no matching constructor for initialization of 'amici::CVodeSolver'
          result = (amici::CVodeSolver *)new amici::CVodeSolver((amici::Solver const &)*arg1);
                                             ^                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  amici/include/amici/solver_cvodes.h:31:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const amici::Solver' to 'const amici::CVodeSolver' for 1st argument
  class CVodeSolver : public Solver {
        ^
  amici/include/amici/solver_cvodes.h:31:7: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
  5 warnings and 2 errors generated.
  error: command '/usr/bin/clang' failed with exit code 1
  error: subprocess-exited-with-error
  
  × Building wheel for amici (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Users/aaguilar/.pyenv/versions/3.8.14/bin/python3.8 /Users/aaguilar/.pyenv/versions/3.8.14/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/tmp4wx1cgm5
  cwd: /private/var/folders/kj/f8dkpgvs5fqf4vprt8x28ndm0000gq/T/pip-install-1c52olr1/amici_b91d0eba4f474e4ca1c0c8ae436cc94a
  Building wheel for amici (pyproject.toml) ... error
  ERROR: Failed building wheel for amici
Failed to build amici
ERROR: Could not build wheels for amici, which is required to install pyproject.toml-based projects

Hi @MadNietzsche, it looks like you changed to Python3.8 - this will give you a rather old version of amici. Please retry with a more recent Python version.

Closing assuming the issue was fixed.