Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install fails on Mac M1 arm64 #1397

Closed
jonvet opened this issue Dec 12, 2021 · 12 comments · Fixed by #1362
Closed

pip install fails on Mac M1 arm64 #1397

jonvet opened this issue Dec 12, 2021 · 12 comments · Fixed by #1362
Labels
bug Something isn't working

Comments

@jonvet
Copy link

jonvet commented Dec 12, 2021

Informations

  • Qiskit Aer version: 0.9.1
  • Python version: 3.9.8
  • Operating system: MacOS 12.0.1, MacBook Pro (16-inch, 2021), Apple M1 Max, 64GB RAM

related to #1286 but I'm not using conda and have trouble at installation, not import

What is the current behavior?

pip install qiskit-aer==0.9.1 fails with the following stacktrace:

pip install qiskit-aer==0.9.1
Collecting qiskit-aer==0.9.1
  Using cached qiskit-aer-0.9.1.tar.gz (6.5 MB)
Requirement already satisfied: numpy>=1.16.3 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-aer==0.9.1) (1.21.4)
Requirement already satisfied: qiskit-terra>=0.17.0 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-aer==0.9.1) (0.19.1)
Requirement already satisfied: scipy>=1.0 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-aer==0.9.1) (1.7.3)
Requirement already satisfied: stevedore>=3.0.0 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (3.5.0)
Requirement already satisfied: sympy>=1.3 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (1.9)
Requirement already satisfied: tweedledum<2.0,>=1.1 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (1.1.1)
Requirement already satisfied: dill>=0.3 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (0.3.4)
Requirement already satisfied: ply>=3.10 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (3.11)
Requirement already satisfied: retworkx>=0.10.1 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (0.10.2)
Requirement already satisfied: python-constraint>=1.4 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (1.4.0)
Requirement already satisfied: symengine>=0.8 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (0.8.1)
Requirement already satisfied: python-dateutil>=2.8.0 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (2.8.2)
Requirement already satisfied: psutil>=5 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (5.8.0)
Requirement already satisfied: six>=1.5 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from python-dateutil>=2.8.0->qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (1.16.0)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from stevedore>=3.0.0->qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (5.8.0)
Requirement already satisfied: mpmath>=0.19 in /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages (from sympy>=1.3->qiskit-terra>=0.17.0->qiskit-aer==0.9.1) (1.2.1)
Building wheels for collected packages: qiskit-aer
  Building wheel for qiskit-aer (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/jonas/.virtualenvs/qiskit-machine-learning/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/setup.py'"'"'; __file__='"'"'/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-wheel-88fe8utr
       cwd: /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/
  Complete output (178 lines):
  
  
  --------------------------------------------------------------------------------
  -- Trying "Ninja" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  -- Configuring incomplete, errors occurred!
  See also "/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Ninja" generator - failure
  --------------------------------------------------------------------------------
  
  
  
  --------------------------------------------------------------------------------
  -- Trying "Unix Makefiles" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  -- The C compiler identification is AppleClang 13.0.0.13000029
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- The CXX compiler identification is AppleClang 13.0.0.13000029
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_cmake_test_compile/build
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Unix Makefiles" generator - success
  --------------------------------------------------------------------------------
  
  Configuring Project
    Working directory:
      /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-build
    Command:
      /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921 -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/Users/jonas/.virtualenvs/qiskit-machine-learning/bin/python -DPYTHON_VERSION_STRING:STRING=3.9.8 -DPYTHON_INCLUDE_DIR:PATH=/Users/jonas/.pyenv/versions/3.9.8/include/python3.9 -DPYTHON_LIBRARY:FILEPATH=/Users/jonas/.pyenv/versions/3.9.8/lib/libpython3.9.a -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/skbuild/resources/cmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES:STRING=arm64
  
  -- The CXX compiler identification is AppleClang 13.0.0.13000029
  -- The C compiler identification is AppleClang 13.0.0.13000029
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Conan: Automatic detection of conan settings from cmake
  In file included from <stdin>:1:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string:506:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string_view:175:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__string:57:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:641:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstring:60:
  /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string.h:60:15: fatal error: 'string.h' file not found
  #include_next <string.h>
                ^~~~~~~~~~
  1 error generated.
  -- Conan: Settings= -s;build_type=Release;-s;compiler=apple-clang;-s;compiler.version=13.0;-s;compiler.libcxx=libc++
  -- Conan: checking conan executable
  -- Conan: Found program /Users/jonas/.virtualenvs/qiskit-machine-learning/bin/conan
  -- Conan: Version found Conan version 1.43.0
  
  -- Conan executing: /Users/jonas/.virtualenvs/qiskit-machine-learning/bin/conan install . -s build_type=Release -s compiler=apple-clang -s compiler.version=13.0 -s compiler.libcxx=libc++ -e=CONAN_CMAKE_PROGRAM=/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake -g=cmake --build=missing
  Configuration:
  [settings]
  arch=armv8
  arch_build=armv8
  build_type=Release
  compiler=apple-clang
  compiler.libcxx=libc++
  compiler.version=13.0
  os=Macos
  os_build=Macos
  [options]
  [build_requires]
  [env]
  CONAN_CMAKE_PROGRAM=/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake
  conanfile.txt: Installing package
  Requirements
      fmt/6.2.1 from 'conancenter' - Cache
      llvm-openmp/8.0.1 from 'conancenter' - Cache
      muparserx/4.0.8 from 'conancenter' - Cache
      nlohmann_json/3.1.1 from 'conancenter' - Cache
      spdlog/1.5.0 from 'conancenter' - Cache
  Packages
      fmt/6.2.1:f1a36a2aea2da1148eb4bddd758d8db183c6db83 - Cache
      llvm-openmp/8.0.1:INVALID - Invalid
      muparserx/4.0.8:f1a36a2aea2da1148eb4bddd758d8db183c6db83 - Build
      nlohmann_json/3.1.1:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
      spdlog/1.5.0:d863312b4f29c9456ba2346cd780521b50ef020a - Build
  
  Installing (downloading, building) binaries...
  ERROR: There are invalid packages (packages that cannot exist for this configuration):
  llvm-openmp/8.0.1: Invalid ID: ARM v8 not supported
  CMake Error at cmake/conan.cmake:402 (message):
    Conan install failed='6'
  Call Stack (most recent call first):
    cmake/conan.cmake:497 (conan_cmake_install)
    cmake/conan_utils.cmake:46 (conan_cmake_run)
    cmake/dependency_utils.cmake:20 (setup_conan)
    CMakeLists.txt:147 (setup_dependencies)
  
  
  -- Configuring incomplete, errors occurred!
  See also "/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-build/CMakeFiles/CMakeOutput.log".
  See also "/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-build/CMakeFiles/CMakeError.log".
  Traceback (most recent call last):
    File "/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 586, in setup
      env = cmkr.configure(cmake_args,
    File "/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/skbuild/cmaker.py", line 237, in configure
      raise SKBuildError(
  
  An error occurred while configuring with CMake.
    Command:
      /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921 -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/Users/jonas/.virtualenvs/qiskit-machine-learning/bin/python -DPYTHON_VERSION_STRING:STRING=3.9.8 -DPYTHON_INCLUDE_DIR:PATH=/Users/jonas/.pyenv/versions/3.9.8/include/python3.9 -DPYTHON_LIBRARY:FILEPATH=/Users/jonas/.pyenv/versions/3.9.8/lib/libpython3.9.a -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/skbuild/resources/cmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES:STRING=arm64
    Source directory:
      /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921
    Working directory:
      /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-build
  Please see CMake's output for more information.
  ----------------------------------------
  ERROR: Failed building wheel for qiskit-aer
  Running setup.py clean for qiskit-aer
Failed to build qiskit-aer
Installing collected packages: qiskit-aer
    Running setup.py install for qiskit-aer ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/jonas/.virtualenvs/qiskit-machine-learning/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/setup.py'"'"'; __file__='"'"'/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-record-gzgcnohb/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jonas/.virtualenvs/qiskit-machine-learning/include/site/python3.9/qiskit-aer
         cwd: /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/
    Complete output (166 lines):
    
    
    --------------------------------------------------------------------------------
    -- Trying "Ninja" generator
    --------------------------------
    ---------------------------
    ----------------------
    -----------------
    ------------
    -------
    --
    Not searching for unused variables given on the command line.
    CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
    -- Configuring incomplete, errors occurred!
    See also "/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
    --
    -------
    ------------
    -----------------
    ----------------------
    ---------------------------
    --------------------------------
    -- Trying "Ninja" generator - failure
    --------------------------------------------------------------------------------
    
    
    
    --------------------------------------------------------------------------------
    -- Trying "Unix Makefiles" generator
    --------------------------------
    ---------------------------
    ----------------------
    -----------------
    ------------
    -------
    --
    Not searching for unused variables given on the command line.
    -- The C compiler identification is AppleClang 13.0.0.13000029
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- The CXX compiler identification is AppleClang 13.0.0.13000029
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_cmake_test_compile/build
    --
    -------
    ------------
    -----------------
    ----------------------
    ---------------------------
    --------------------------------
    -- Trying "Unix Makefiles" generator - success
    --------------------------------------------------------------------------------
    
    Configuring Project
      Working directory:
        /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-build
      Command:
        /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921 -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/Users/jonas/.virtualenvs/qiskit-machine-learning/bin/python -DPYTHON_VERSION_STRING:STRING=3.9.8 -DPYTHON_INCLUDE_DIR:PATH=/Users/jonas/.pyenv/versions/3.9.8/include/python3.9 -DPYTHON_LIBRARY:FILEPATH=/Users/jonas/.pyenv/versions/3.9.8/lib/libpython3.9.a -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/skbuild/resources/cmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES:STRING=arm64
    
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Conan: Automatic detection of conan settings from cmake
    In file included from <stdin>:1:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string:506:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string_view:175:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__string:57:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:641:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstring:60:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string.h:60:15: fatal error: 'string.h' file not found
    #include_next <string.h>
                  ^~~~~~~~~~
    1 error generated.
    -- Conan: Settings= -s;build_type=Release;-s;compiler=apple-clang;-s;compiler.version=13.0;-s;compiler.libcxx=libc++
    -- Conan: checking conan executable
    -- Conan: Found program /Users/jonas/.virtualenvs/qiskit-machine-learning/bin/conan
    -- Conan: Version found Conan version 1.43.0
    
    -- Conan executing: /Users/jonas/.virtualenvs/qiskit-machine-learning/bin/conan install . -s build_type=Release -s compiler=apple-clang -s compiler.version=13.0 -s compiler.libcxx=libc++ -e=CONAN_CMAKE_PROGRAM=/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake -g=cmake --build=missing
    Configuration:
    [settings]
    arch=armv8
    arch_build=armv8
    build_type=Release
    compiler=apple-clang
    compiler.libcxx=libc++
    compiler.version=13.0
    os=Macos
    os_build=Macos
    [options]
    [build_requires]
    [env]
    CONAN_CMAKE_PROGRAM=/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake
    conanfile.txt: Installing package
    Requirements
        fmt/6.2.1 from 'conancenter' - Cache
        llvm-openmp/8.0.1 from 'conancenter' - Cache
        muparserx/4.0.8 from 'conancenter' - Cache
        nlohmann_json/3.1.1 from 'conancenter' - Cache
        spdlog/1.5.0 from 'conancenter' - Cache
    Packages
        fmt/6.2.1:f1a36a2aea2da1148eb4bddd758d8db183c6db83 - Cache
        llvm-openmp/8.0.1:INVALID - Invalid
        muparserx/4.0.8:f1a36a2aea2da1148eb4bddd758d8db183c6db83 - Build
        nlohmann_json/3.1.1:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
        spdlog/1.5.0:d863312b4f29c9456ba2346cd780521b50ef020a - Build
    
    Installing (downloading, building) binaries...
    ERROR: There are invalid packages (packages that cannot exist for this configuration):
    llvm-openmp/8.0.1: Invalid ID: ARM v8 not supported
    CMake Error at cmake/conan.cmake:402 (message):
      Conan install failed='6'
    Call Stack (most recent call first):
      cmake/conan.cmake:497 (conan_cmake_install)
      cmake/conan_utils.cmake:46 (conan_cmake_run)
      cmake/dependency_utils.cmake:20 (setup_conan)
      CMakeLists.txt:147 (setup_dependencies)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-build/CMakeFiles/CMakeOutput.log".
    See also "/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-build/CMakeFiles/CMakeError.log".
    Traceback (most recent call last):
      File "/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 586, in setup
        env = cmkr.configure(cmake_args,
      File "/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/skbuild/cmaker.py", line 237, in configure
        raise SKBuildError(
    
    An error occurred while configuring with CMake.
      Command:
        /Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921 -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/Users/jonas/.virtualenvs/qiskit-machine-learning/bin/python -DPYTHON_VERSION_STRING:STRING=3.9.8 -DPYTHON_INCLUDE_DIR:PATH=/Users/jonas/.pyenv/versions/3.9.8/include/python3.9 -DPYTHON_LIBRARY:FILEPATH=/Users/jonas/.pyenv/versions/3.9.8/lib/libpython3.9.a -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/Users/jonas/.virtualenvs/qiskit-machine-learning/lib/python3.9/site-packages/skbuild/resources/cmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9 -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES:STRING=arm64
      Source directory:
        /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921
      Working directory:
        /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/_skbuild/macosx-10.9-arm64-3.9/cmake-build
    Please see CMake's output for more information.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/jonas/.virtualenvs/qiskit-machine-learning/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/setup.py'"'"'; __file__='"'"'/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-install-utvtt_1x/qiskit-aer_16062fa9067c41cf9bfd2e6b0dd9e921/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-record-gzgcnohb/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jonas/.virtualenvs/qiskit-machine-learning/include/site/python3.9/qiskit-aer Check the logs for full command output.

Steps to reproduce the problem

  1. Create a python 3.9.8 virtual environment (i used pyenv)
pyenv install 3.9.8
pyenv global 3.9.8
python -m venv ~/.virtualenvs/qiskit-machine-learning
  1. activate env source ~/.virtualenvs/qiskit-machine-learning/bin/activate
  2. try to install qiskit-aer pip install qiskit-aer==0.9.1

What is the expected behavior?

Suggested solutions

@jonvet jonvet added the bug Something isn't working label Dec 12, 2021
@jonvet jonvet changed the title Install fails with Mac M1 arm64 pip install fails on Mac M1 arm64 Dec 12, 2021
@JoelHBierman
Copy link

JoelHBierman commented Dec 12, 2021

Try pip installing straight from the main GitHub branch using:

pip install "git+https://github.com/Qiskit/qiskit-aer.git"

The reason your installation seems to be failing is that there are no Qiskit Aer binaries on pypi for M1 Macs (at least not yet- it is in the works. See #1362.), so it is attempting to build it from source, which fails because Qiskit-Aer 0.9.1 uses openmp 8.0.1. A minimum version of openmp 12.0.1 is needed to build from source for M1 Macs. There have been fixes discussed in #1286 and merged to the main branch (see pull request #1348), so installing straight from the main GitHub branch or building from source using a clone of the main GitHub branch should work.

@jonvet
Copy link
Author

jonvet commented Dec 12, 2021

thanks @JoelHBierman

I tried what you suggested in a fresh env, but it still doesn't seem to work. I can see that it's using openmp 12.0.1 now though

pip install "git+https://github.com/Qiskit/qiskit-aer.git"
Collecting git+https://github.com/Qiskit/qiskit-aer.git
  Cloning https://github.com/Qiskit/qiskit-aer.git to /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9
  Running command git clone -q https://github.com/Qiskit/qiskit-aer.git /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9
  Resolved https://github.com/Qiskit/qiskit-aer.git to commit fb4cfa205f6b6860f69980a91a8dbe85e7d0dd22
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting numpy>=1.16.3
  Using cached numpy-1.21.4-cp39-cp39-macosx_11_0_arm64.whl (12.4 MB)
Collecting qiskit-terra>=0.17.0
  Using cached qiskit_terra-0.19.1-cp39-cp39-macosx_10_9_universal2.whl (5.8 MB)
Collecting scipy>=1.0
  Using cached scipy-1.7.3-1-cp39-cp39-macosx_12_0_arm64.whl (27.0 MB)
Collecting python-dateutil>=2.8.0
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting retworkx>=0.10.1
  Using cached retworkx-0.10.2-cp39-cp39-macosx_11_0_arm64.whl (1.0 MB)
Collecting stevedore>=3.0.0
  Using cached stevedore-3.5.0-py3-none-any.whl (49 kB)
Collecting symengine>=0.8
  Using cached symengine-0.8.1-cp39-cp39-macosx_11_0_arm64.whl (14.6 MB)
Collecting psutil>=5
  Using cached psutil-5.8.0-cp39-cp39-macosx_12_0_arm64.whl
Collecting ply>=3.10
  Using cached ply-3.11-py2.py3-none-any.whl (49 kB)
Collecting sympy>=1.3
  Using cached sympy-1.9-py3-none-any.whl (6.2 MB)
Collecting python-constraint>=1.4
  Using cached python_constraint-1.4.0-py2.py3-none-any.whl
Collecting tweedledum<2.0,>=1.1
  Using cached tweedledum-1.1.1-cp39-cp39-macosx_12_0_arm64.whl
Collecting dill>=0.3
  Using cached dill-0.3.4-py2.py3-none-any.whl (86 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pbr!=2.1.0,>=2.0.0
  Using cached pbr-5.8.0-py2.py3-none-any.whl (112 kB)
Collecting mpmath>=0.19
  Using cached mpmath-1.2.1-py3-none-any.whl (532 kB)
Building wheels for collected packages: qiskit-aer
  Building wheel for qiskit-aer (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/jonas/.virtualenvs/qiskit-machine-learning2/bin/python /Users/jonas/.virtualenvs/qiskit-machine-learning2/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/tmpn_o00e2v
       cwd: /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9
  Complete output (161 lines):
  Not searching for unused variables given on the command line.
  -- The C compiler identification is AppleClang 13.0.0.13000029
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- The CXX compiler identification is AppleClang 13.0.0.13000029
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9/_cmake_test_compile/build
  -- The CXX compiler identification is AppleClang 13.0.0.13000029
  -- The C compiler identification is AppleClang 13.0.0.13000029
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Performing Test flag_supported
  -- Performing Test flag_supported - Success
  -- Conan: Automatic detection of conan settings from cmake
  In file included from <stdin>:1:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string:506:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string_view:175:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__string:57:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:641:
  In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstring:60:
  /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string.h:60:15: fatal error: 'string.h' file not found
  #include_next <string.h>
                ^~~~~~~~~~
  1 error generated.
  -- Conan: Settings= -s;build_type=Release;-s;compiler=apple-clang;-s;compiler.version=13.0;-s;compiler.libcxx=libc++
  -- Conan: checking conan executable
  -- Conan: Found program /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-build-env-pefg6e2p/overlay/bin/conan
  -- Conan: Version found Conan version 1.43.0

  -- Conan executing: /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-build-env-pefg6e2p/overlay/bin/conan install . -s build_type=Release -s compiler=apple-clang -s compiler.version=13.0 -s compiler.libcxx=libc++ -e=CONAN_CMAKE_PROGRAM=/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-build-env-pefg6e2p/overlay/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake -g=cmake --build=missing
  Configuration:
  [settings]
  arch=armv8
  arch_build=armv8
  build_type=Release
  compiler=apple-clang
  compiler.libcxx=libc++
  compiler.version=13.0
  os=Macos
  os_build=Macos
  [options]
  [build_requires]
  [env]
  CONAN_CMAKE_PROGRAM=/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-build-env-pefg6e2p/overlay/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake
  llvm-openmp/12.0.1: WARN: Package binary is corrupted, removing: 2b2201f54b77f855edf1189196431cb2e3f87839
  conanfile.txt: Installing package
  Requirements
      fmt/6.2.1 from 'conancenter' - Cache
      llvm-openmp/12.0.1 from 'conancenter' - Cache
      muparserx/4.0.8 from 'conancenter' - Cache
      nlohmann_json/3.1.1 from 'conancenter' - Cache
      spdlog/1.5.0 from 'conancenter' - Cache
  Packages
      fmt/6.2.1:f1a36a2aea2da1148eb4bddd758d8db183c6db83 - Cache
      llvm-openmp/12.0.1:2b2201f54b77f855edf1189196431cb2e3f87839 - Build
      muparserx/4.0.8:f1a36a2aea2da1148eb4bddd758d8db183c6db83 - Build
      nlohmann_json/3.1.1:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
      spdlog/1.5.0:d863312b4f29c9456ba2346cd780521b50ef020a - Build

  Installing (downloading, building) binaries...
  fmt/6.2.1: Already installed!
  llvm-openmp/12.0.1: WARN: Build folder is dirty, removing it: /Users/jonas/.conan/data/llvm-openmp/12.0.1/_/_/build/2b2201f54b77f855edf1189196431cb2e3f87839
  llvm-openmp/12.0.1: WARN: Trying to remove corrupted source folder
  llvm-openmp/12.0.1: WARN: This can take a while for big packages
  llvm-openmp/12.0.1: Configuring sources in /Users/jonas/.conan/data/llvm-openmp/12.0.1/_/_/source

  ERROR: llvm-openmp/12.0.1: Error in source() method, line 57
  	tools.get(**self.conan_data["sources"][self.version])
  	ReadError: file could not be opened successfully
  CMake Error at cmake/conan.cmake:402 (message):
    Conan install failed='1'
  Call Stack (most recent call first):
    cmake/conan.cmake:497 (conan_cmake_install)
    cmake/conan_utils.cmake:46 (conan_cmake_run)
    cmake/dependency_utils.cmake:20 (setup_conan)
    CMakeLists.txt:146 (setup_dependencies)


  -- Configuring incomplete, errors occurred!
  See also "/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9/_skbuild/macosx-12.0-arm64-3.9/cmake-build/CMakeFiles/CMakeOutput.log".
  See also "/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9/_skbuild/macosx-12.0-arm64-3.9/cmake-build/CMakeFiles/CMakeError.log".
    File "/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-build-env-pefg6e2p/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 586, in setup
      env = cmkr.configure(cmake_args,
    File "/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-build-env-pefg6e2p/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 237, in configure
      raise SKBuildError(


  --------------------------------------------------------------------------------
  -- Trying "Ninja" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Ninja" generator - success
  --------------------------------------------------------------------------------

  Configuring Project
    Working directory:
      /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9/_skbuild/macosx-12.0-arm64-3.9/cmake-build
    Command:
      /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-build-env-pefg6e2p/overlay/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9 -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9/_skbuild/macosx-12.0-arm64-3.9/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/Users/jonas/.virtualenvs/qiskit-machine-learning2/bin/python -DPYTHON_VERSION_STRING:STRING=3.9.8 -DPYTHON_INCLUDE_DIR:PATH=/Users/jonas/.pyenv/versions/3.9.8/include/python3.9 -DPYTHON_LIBRARY:FILEPATH=/Users/jonas/.pyenv/versions/3.9.8/lib/libpython3.9.a -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-build-env-pefg6e2p/overlay/lib/python3.9/site-packages/skbuild/resources/cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=12.0 -DCMAKE_OSX_ARCHITECTURES:STRING=arm64

  Traceback (most recent call last):

  An error occurred while configuring with CMake.
    Command:
      /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-build-env-pefg6e2p/overlay/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9 -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9/_skbuild/macosx-12.0-arm64-3.9/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/Users/jonas/.virtualenvs/qiskit-machine-learning2/bin/python -DPYTHON_VERSION_STRING:STRING=3.9.8 -DPYTHON_INCLUDE_DIR:PATH=/Users/jonas/.pyenv/versions/3.9.8/include/python3.9 -DPYTHON_LIBRARY:FILEPATH=/Users/jonas/.pyenv/versions/3.9.8/lib/libpython3.9.a -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-build-env-pefg6e2p/overlay/lib/python3.9/site-packages/skbuild/resources/cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=12.0 -DCMAKE_OSX_ARCHITECTURES:STRING=arm64
    Source directory:
      /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9
    Working directory:
      /private/var/folders/7w/r3ys0c4s3d1bmtvx82f312hr0000gn/T/pip-req-build-r9r2u8a9/_skbuild/macosx-12.0-arm64-3.9/cmake-build
  Please see CMake's output for more information.
  ----------------------------------------
  ERROR: Failed building wheel for qiskit-aer
Failed to build qiskit-aer
ERROR: Could not build wheels for qiskit-aer which use PEP 517 and cannot be installed directly

@JoelHBierman
Copy link

JoelHBierman commented Dec 12, 2021

This is bit of a strange and interesting issue. I have two M1 machines: an M1 MacBook Pro which I updated to Monterey and the newest version of Xcode command line tools along with it and an M1 Mini which I have kept running Big Sur and an older version of the command line tools just in case Monterey or Xcode had breaking changes in them. The MBP is using Clang 13.0.0 and the Mini is using Clang 12.0.5. The Aer build fails on the MBP with Monterey and clang 13.0.0, but succeeds on the Mini. This suggests that there might be some breaking change issue with either Monterey, Xcode, clang, Conan, or some combination of these and how they interact. (Of course there are other differences in the environments between the two machines so it could be due to other build dependencies as well.) I wonder if there is a way to force using Clang 12.0.x or to install an older version of Xcode command line tools? I might test this out later if I have the time, but it is something you could try.

@JoelHBierman
Copy link

JoelHBierman commented Dec 12, 2021

@mtreinish @vvilpas This seems to be a separate issue from the fixes discussed in #1286 and could be related to why the arm64 wheel jobs in #1362 are failing. This is possibly related to MacOS 12.0.1 and/or the latest version of Xcode command line tools/Clang. There don't appear to be any issues with Qiskit Aer running on a machine with MacOS 12.0.1 (You can pip install from the main GitHub branch with the previous Xcode command line tools version and MacOS 11, then install the wheel on MacOS 12 just fine), but there do appear to be new issues with building it on this setup.

mtreinish added a commit that referenced this issue Jan 19, 2022
This PR adds CI jobs to build qiskit-aer wheels on arm64 macOS wheels. Since no CI system provides native arm64
macOS environments these CI jobs are configured to cross compile arm64 binaries from an x86_64 macOS
environment. This has the limitation of not letting us execute the binaries but we can at least test building them in
PR CI and publish the built binaries at release time. The two jobs added here do just that, the first is run as part
of the Build workflow that runs on every proposed commit to test that we can at least compile on arm64 macOS
(for supported python versions). The second job is a release publishing job that will build and publish arm64
macOS wheels to PyPI whenever there is a release.

Fixes #1286
Fixes #1397
@mtreinish
Copy link
Member

This was closed by #1362 because that PR added the release time CI jobs to build and publish arm64 macos wheels. The precompiled binaries will be published to pypi automatically as part of the next qiskit-aer release. If there are any issues after the next release running on macOS with arm64 feel free to reopen this or open a new issue.

hhorii pushed a commit to hhorii/qiskit-aer that referenced this issue Jan 21, 2022
This PR adds CI jobs to build qiskit-aer wheels on arm64 macOS wheels. Since no CI system provides native arm64
macOS environments these CI jobs are configured to cross compile arm64 binaries from an x86_64 macOS
environment. This has the limitation of not letting us execute the binaries but we can at least test building them in
PR CI and publish the built binaries at release time. The two jobs added here do just that, the first is run as part
of the Build workflow that runs on every proposed commit to test that we can at least compile on arm64 macOS
(for supported python versions). The second job is a release publishing job that will build and publish arm64
macOS wheels to PyPI whenever there is a release.

Fixes Qiskit#1286
Fixes Qiskit#1397
@starsplash
Copy link

Hi,

I'm running into ERROR: llvm-openmp/12.0.1: Error in source() method, line 57 with:

Qiskit Aer version: 0.10.2
Python version: 3.9.10
Operating system: MacOS 12.2, MacBook Pro (13-inch, 2020), Apple M1, 16GB RAM

Is this because of MacOS 12.2/clang version 13.0?

Thanks for any help!

Cheers,
Stephan

@starsplash
Copy link

Never mind, python version 3.9.8 works.

hhorii pushed a commit that referenced this issue Feb 9, 2022
This PR adds CI jobs to build qiskit-aer wheels on arm64 macOS wheels. Since no CI system provides native arm64
macOS environments these CI jobs are configured to cross compile arm64 binaries from an x86_64 macOS
environment. This has the limitation of not letting us execute the binaries but we can at least test building them in
PR CI and publish the built binaries at release time. The two jobs added here do just that, the first is run as part
of the Build workflow that runs on every proposed commit to test that we can at least compile on arm64 macOS
(for supported python versions). The second job is a release publishing job that will build and publish arm64
macOS wheels to PyPI whenever there is a release.

Fixes #1286
Fixes #1397
hhorii pushed a commit to hhorii/qiskit-aer that referenced this issue Feb 9, 2022
This PR adds CI jobs to build qiskit-aer wheels on arm64 macOS wheels. Since no CI system provides native arm64
macOS environments these CI jobs are configured to cross compile arm64 binaries from an x86_64 macOS
environment. This has the limitation of not letting us execute the binaries but we can at least test building them in
PR CI and publish the built binaries at release time. The two jobs added here do just that, the first is run as part
of the Build workflow that runs on every proposed commit to test that we can at least compile on arm64 macOS
(for supported python versions). The second job is a release publishing job that will build and publish arm64
macOS wheels to PyPI whenever there is a release.

Fixes Qiskit#1286
Fixes Qiskit#1397
@HuangJunye
Copy link

I can reproduce the same error message on a 2019 Intel 16 inch MBP

  • macOS Monterey 12.2.1
  • XCode command line version 13.2.0.0.1.1638488800.
> pkgutil --pkg-info=com.apple.pkg.CLTools_macOS_SDK
package-id: com.apple.pkg.CLTools_macOS_SDK
version: 13.2.0.0.1.1638488800

The cause seems to be relocation of c++ headers files in recent XCode.

The Command Line Tools package installs the macOS system headers inside the macOS SDK. Software that compiles with the installed tools will search for headers within the macOS SDK provided by either Xcode at:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

or the Command Line Tools at:

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

depending on which is selected using xcode-select.

The command line tools will search the SDK for system headers by default. However, some software may fail to build correctly against the SDK and require macOS headers to be installed in the base system under /usr/include. If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug report for issues that are preventing you from doing so. As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided. You can find this package at:

/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

To make sure that you’re using the intended version of the command line tools, run xcode-select -s or xcode select -s /Library/Developer/CommandLineTools after installing.

References:

However, this change was introduced in 2019 so I am not sure why it was working for the Mac Mini with Big Sur and an older version of command line tools.

This is bit of a strange and interesting issue. I have two M1 machines: an M1 MacBook Pro which I updated to Monterey and the newest version of Xcode command line tools along with it and an M1 Mini which I have kept running Big Sur and an older version of the command line tools just in case Monterey or Xcode had breaking changes in them. The MBP is using Clang 13.0.0 and the Mini is using Clang 12.0.5. The Aer build fails on the MBP with Monterey and clang 13.0.0, but succeeds on the Mini. This suggests that there might be some breaking change issue with either Monterey, Xcode, clang, Conan, or some combination of these and how they interact. (Of course there are other differences in the environments between the two machines so it could be due to other build dependencies as well.) I wonder if there is a way to force using Clang 12.0.x or to install an older version of Xcode command line tools? I might test this out later if I have the time, but it is something you could try.

Can we modify the path to include files in the build system

  • /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include or
  • /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include

similar to this answer on StackOverflow?

@jakelishman
Copy link
Member

jakelishman commented Mar 2, 2022

The first line in your answer should be the default sysroot for your compiler on Mac automatically - if it isn't, it's likely something's misconfigured with your compiler locally. Make sure that the C compiler you're trying to use is the system clang, and not some other version (you can configure those to work, it's just trickier). We don't want to support non-system compilers on Mac because it's a lot of configuration work, and Apple change what we'd need unfortunately frequently. You can also try rerunning xcode-select --install, and if that doesn't work, uninstalling the command line tools completely and reinstalling them - I've had similar path issues after updates to macOS or XCode before.

That StackOverflow answer is incomplete too - if your compiler is failing to find those includes, it will likely fail to link system libraries as well. You'd need to set the sysroot, not just the include path. But in this case, I think it's much more likely to be a local misconfiguration somehow.

Also, what exact error are you getting? You said you were reproducing the errors in the issue, which are about the LLVM dependency (which we don't get from the system), but then your comment is about failing to find standard library headers.

@jakelishman
Copy link
Member

(Note that in theory, xcode-select should let you choose the macOS API version it targets without reinstallation, but in my experience if thing suddenly stopped working, I could never get the normal selection methods to work.)

@HuangJunye
Copy link

@jakelishman Thanks for your quick reply and advice. Let me see if I can get it working. Is this issue about LLVM dependency? I must misread something but I see the line of missing string.h header file is similar to what I saw so I thought it's the same issue. Below is the full error message I see.

Installing collected packages: qiskit-aer
  Running setup.py develop for qiskit-aer
    ERROR: Command errored out with exit status 1:
     command: /usr/local/anaconda3/envs/qiskit-dev/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/setup.py'"'"'; __file__='"'"'/Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: /Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/
    Complete output (111 lines):
    /private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-vstsppzs/overlay/lib/python3.9/site-packages/setuptools/command/easy_install.py:160: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    Not searching for unused variables given on the command line.
    -- The C compiler identification is AppleClang 13.0.0.13000027
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- The CXX compiler identification is AppleClang 13.0.0.13000027
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/_cmake_test_compile/build
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Performing Test flag_supported
    -- Performing Test flag_supported - Success
    -- Conan: Automatic detection of conan settings from cmake
    In file included from <stdin>:1:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string:506:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string_view:175:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__string:57:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:641:
    In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cstring:60:
    /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string.h:60:15: fatal error: 'string.h' file not found
    #include_next <string.h>
                  ^~~~~~~~~~
    1 error generated.
    -- Conan: Settings= -s;build_type=Release;-s;compiler=apple-clang;-s;compiler.version=13.0;-s;compiler.libcxx=libc++
    -- Conan: checking conan executable
    -- Conan: Found program /private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-tv1wh1fd/overlay/bin/conan
    -- Conan: Version found
    -- Conan executing: /private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-tv1wh1fd/overlay/bin/conan install . -s build_type=Release -s compiler=apple-clang -s compiler.version=13.0 -s compiler.libcxx=libc++ -e=CONAN_CMAKE_PROGRAM=/private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-vstsppzs/overlay/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake -g=cmake --build=missing
    CMake Error at cmake/conan.cmake:402 (message):
      Conan install failed='No such file or directory'
    Call Stack (most recent call first):
      cmake/conan.cmake:497 (conan_cmake_install)
      cmake/conan_utils.cmake:56 (conan_cmake_run)
      cmake/dependency_utils.cmake:20 (setup_conan)
      CMakeLists.txt:146 (setup_dependencies)


    -- Configuring incomplete, errors occurred!
    See also "/Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/_skbuild/macosx-12.0-x86_64-3.9/cmake-build/CMakeFiles/CMakeOutput.log".
    See also "/Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/_skbuild/macosx-12.0-x86_64-3.9/cmake-build/CMakeFiles/CMakeError.log".
      File "/private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-vstsppzs/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 588, in setup
        env = cmkr.configure(cmake_args,
      File "/private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-vstsppzs/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 289, in configure
        raise SKBuildError(
    An error occurred while configuring with CMake.
      Command:
        /private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-vstsppzs/overlay/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake /Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/_skbuild/macosx-12.0-x86_64-3.9/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/usr/local/anaconda3/envs/qiskit-dev/bin/python -DPYTHON_VERSION_STRING:STRING=3.9.10 -DPYTHON_INCLUDE_DIR:PATH=/usr/local/anaconda3/envs/qiskit-dev/include/python3.9 -DPYTHON_LIBRARY:FILEPATH=/usr/local/anaconda3/envs/qiskit-dev/lib/libpython3.9.dylib -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-vstsppzs/overlay/lib/python3.9/site-packages/skbuild/resources/cmake -DCMAKE_MAKE_PROGRAM:FILEPATH=/private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-vstsppzs/overlay/lib/python3.9/site-packages/ninja/data/bin/ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=12.0 -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64
      Source directory:
        /Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer
      Working directory:
        /Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/_skbuild/macosx-12.0-x86_64-3.9/cmake-build
    Please see CMake's output for more information.


    --------------------------------------------------------------------------------
    -- Trying "Ninja" generator
    --------------------------------
    ---------------------------
    ----------------------
    -----------------
    ------------
    -------
    --
    --
    -------
    ------------
    -----------------
    ----------------------
    ---------------------------
    --------------------------------
    -- Trying "Ninja" generator - success
    --------------------------------------------------------------------------------

    Configuring Project
      Working directory:
        /Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/_skbuild/macosx-12.0-x86_64-3.9/cmake-build
      Command:
        /private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-vstsppzs/overlay/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/bin/cmake /Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/_skbuild/macosx-12.0-x86_64-3.9/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/usr/local/anaconda3/envs/qiskit-dev/bin/python -DPYTHON_VERSION_STRING:STRING=3.9.10 -DPYTHON_INCLUDE_DIR:PATH=/usr/local/anaconda3/envs/qiskit-dev/include/python3.9 -DPYTHON_LIBRARY:FILEPATH=/usr/local/anaconda3/envs/qiskit-dev/lib/libpython3.9.dylib -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-vstsppzs/overlay/lib/python3.9/site-packages/skbuild/resources/cmake -DCMAKE_MAKE_PROGRAM:FILEPATH=/private/var/folders/3q/wv2nrp5s3d9c4ftzs7zdfrx40000gn/T/pip-build-env-vstsppzs/overlay/lib/python3.9/site-packages/ninja/data/bin/ninja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=12.0 -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64

    Traceback (most recent call last):

    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/anaconda3/envs/qiskit-dev/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/setup.py'"'"'; __file__='"'"'/Users/junye/Documents/Github/HJY/qiskit-dev/qiskit-aer/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

@jakelishman
Copy link
Member

The dependency is on OpenMP, and the reason "llvm" appears in its name is that we need the OpenMP library for the LLVM suite, since the system Mac compiler is clang, which is part of LLVM. Unfortunately, the system one doesn't ship with OpenMP support (no idea why Apple limit it like that).

In this case, it's quite possible that it's just a dirty build environment messing you up. Try removing the entire _skbuild directory in the repo root, and trying to rebuild.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants