Qiskit / qiskit-aer

Aer is a high performance simulator for quantum circuits that includes noise models
https://qiskit.github.io/qiskit-aer/
Apache License 2.0
472 stars 354 forks source link

Pip install is broken on master #546

Closed mtreinish closed 4 years ago

mtreinish commented 4 years ago

Informations

What is the current behavior?

Attempting to pip install a bare repo no longer works since the pulse simulator branch was merged into master with: https://github.com/Qiskit/qiskit-aer/commit/40d903797e497c281bbb6fb42d1e45ccfcc482d7

Running from a clean local clone of the aer repo yields:

Processing ./qiskit-aer
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
Collecting pybind11>=2.4
  Using cached pybind11-2.4.3-py2.py3-none-any.whl (150 kB)
Collecting numpy>=1.13
  Using cached numpy-1.18.1-cp37-cp37m-manylinux1_x86_64.whl (20.1 MB)
Building wheels for collected packages: qiskit-aer
  Building wheel for qiskit-aer (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /tmp/aer-git-test-37/bin/python3.7 /tmp/aer-git-test-37/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpw7pa94fd
       cwd: /tmp/pip-req-build-h5b2eahx
  Complete output (146 lines):
  Not searching for unused variables given on the command line.
  -- The C compiler identification is GNU 9.2.0
  -- Check for working C compiler: /usr/bin/gcc
  -- Check for working C compiler: /usr/bin/gcc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- The CXX compiler identification is GNU 9.2.0
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /tmp/pip-req-build-h5b2eahx/_cmake_test_compile/build
  -- The CXX compiler identification is GNU 9.2.0
  -- The C compiler identification is GNU 9.2.0
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Check for working C compiler: /usr/bin/gcc
  -- Check for working C compiler: /usr/bin/gcc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- 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
  -- Looking for OpenMP support...
  -- OpenMP found!
  -- Looking for NLOHMANN Json library...
  -- nlohmann include dir: /tmp/pip-req-build-h5b2eahx/src/third-party/headers
  -- Looking for pthread.h
  -- Looking for pthread.h - found
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
  -- Looking for pthread_create in pthreads
  -- Looking for pthread_create in pthreads - not found
  -- Looking for pthread_create in pthread
  -- Looking for pthread_create in pthread - found
  -- Found Threads: TRUE
  -- Looking for OpenBLAS library...
  -- BLAS library found: /usr/lib/libopenblas.so
  -- Looking for spdlog library...
  CMake Warning at CMakeLists.txt:183 (find_package):
    By not providing "Findspdlog.cmake" in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by "spdlog", but
    CMake did not find one.

    Could not find a package configuration file provided by "spdlog" with any
    of the following names:

      spdlogConfig.cmake
      spdlog-config.cmake

    Add the installation prefix of "spdlog" to CMAKE_PREFIX_PATH or set
    "spdlog_DIR" to a directory containing one of the above files.  If "spdlog"
    provides a separate development package or SDK, be sure it has been
    installed.

  -- spdlog not found.
  -- Uncompressing muparserx static library...
  x libmuparserx.a
  -- Muparserx library found: /tmp/pip-req-build-h5b2eahx/src/third-party/linux/lib/libmuparserx.a
  -- Submodule update
  Submodule 'src/third-party/headers/muparserx' (https://github.com/beltoforion/muparserx) registered for path 'src/third-party/headers/muparserx'
  Cloning into '/tmp/pip-req-build-h5b2eahx/src/third-party/headers/muparserx'...
  Submodule path 'src/third-party/headers/muparserx': checked out '08cbfc3e9087e8fceafc85c8fdb7e034e1c35943'
  -- Found PythonInterp: /tmp/aer-git-test-37/bin/python3.7 (found version "3.7.5")
  -- Found PythonLibs: /usr/lib/libpython3.7m.so (found version "3.7.5")
  -c:42: DeprecationWarning: SO is deprecated, use EXT_SUFFIX
  -- Found Cython: /tmp/pip-build-env-l92hd0ob/normal/bin/cython
  CMake Error at /tmp/pip-build-env-l92hd0ob/overlay/lib/python3.7/site-packages/cmake/data/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
    Could NOT find NumPy (missing: NumPy_INCLUDE_DIR) (found version "")
  Call Stack (most recent call first):
    /tmp/pip-build-env-l92hd0ob/overlay/lib/python3.7/site-packages/cmake/data/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
    /tmp/pip-build-env-l92hd0ob/overlay/lib/python3.7/site-packages/skbuild/resources/cmake/FindNumPy.cmake:98 (find_package_handle_standard_args)
    cmake/cython_utils.cmake:4 (find_package)
    qiskit/providers/aer/openpulse/cy/CMakeLists.txt:4 (include)

  -- Configuring incomplete, errors occurred!
  See also "/tmp/pip-req-build-h5b2eahx/_skbuild/linux-x86_64-3.7/cmake-build/CMakeFiles/CMakeOutput.log".
  See also "/tmp/pip-req-build-h5b2eahx/_skbuild/linux-x86_64-3.7/cmake-build/CMakeFiles/CMakeError.log".
    File "/tmp/pip-build-env-l92hd0ob/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 574, in setup
      languages=cmake_languages
    File "/tmp/pip-build-env-l92hd0ob/overlay/lib/python3.7/site-packages/skbuild/cmaker.py", line 232, in configure
      os.path.abspath(CMAKE_BUILD_DIR())))

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

  Traceback (most recent call last):

  An error occurred while configuring with CMake.
    Command:
      "/tmp/pip-build-env-l92hd0ob/overlay/lib/python3.7/site-packages/cmake/data/bin/cmake" "/tmp/pip-req-build-h5b2eahx" "-G" "Ninja" "-DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-req-build-h5b2eahx/_skbuild/linux-x86_64-3.7/cmake-install" "-DPYTHON_EXECUTABLE:FILEPATH=/tmp/aer-git-test-37/bin/python3.7" "-DPYTHON_VERSION_STRING:STRING=3.7.5" "-DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.7m" "-DPYTHON_LIBRARY:FILEPATH=/usr/lib/libpython3.7m.so" "-DSKBUILD:BOOL=TRUE" "-DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-l92hd0ob/overlay/lib/python3.7/site-packages/skbuild/resources/cmake" "-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.9" "-DCMAKE_BUILD_TYPE:STRING=Release"
    Source directory:
      /tmp/pip-req-build-h5b2eahx
    Working directory:
      /tmp/pip-req-build-h5b2eahx/_skbuild/linux-x86_64-3.7/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

Steps to reproduce the problem

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

git clone https://github.com/Qiskit/qiskit-aer && pip install ./qiskit-aer

What is the expected behavior?

Pip will build and install the aer python package

Suggested solutions

Fix the issue introduced from the pulse simulator

chriseclectic commented 4 years ago

@atilag It also looks like building wheel manually is broken unless you install requirements first too. Using anaconda I have

conda create -n test-env python=3.7 -y; conda activate test-env
python setup.py bdist_wheel

returns same cmake error message as @mtreinish posted.

But running the following builds successfully:

conda create -n test-env python=3.7 -y; conda activate test-env
pip install -r requirements-dev.txt
python setup.py bdist_wheel
pip install dist/*

(running pip install -r requirements-dev.txt; pip install . still fails)

chriseclectic commented 4 years ago

Editing setup.py to include:

try:
    import numpy
except ImportError:
    subprocess.call([sys.executable, '-m', 'pip', 'install', 'numpy>=1.13'])

and

requirements = [
    "numpy>=1.13",
    "scipy>=1.0",
    "pybind11>=2.4",
    "cython>=0.27.1"
]

and

setup_requires=['scikit-build', 'cmake', 'Cython', 'pybind11>2.4', 'numpy>=1.13']

got me a little bit further (bdist_wheel build works), and pip install . now gives following error:

-- Configuring done
  -- Generating done
  -- Build files have been written to: /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-req-build-a5quw6vk/_skbuild/macosx-10.9-x86_64-3.7/cmake-build
  [1/38] Generating CXX source src/simulators/open_pulse/numeric_integrator_wrapper.cxx
  [2/38] Generating CXX source src/simulators/open_pulse/test_python_to_cpp.cxx
  [3/38] Building CXX object qiskit/providers/aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o
  FAILED: qiskit/providers/aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o
  ccache /Library/Developer/CommandLineTools/usr/bin/c++  -Dcontroller_wrappers_EXPORTS -I../../../src/third-party/macos/lib -I/Users/cjwood/anaconda3/envs/test-env2/include/python3.7m -I/Users/cjwood/anaconda3/envs/test-env2/include -I../../../src -I../../../src/third-party/win64/lib -I../../../src/third-party/linux/lib -isystem ../../../src/third-party/headers -fvisibility=hidden -O3 -DNDEBUG -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.9 -fPIC -fvisibility=hidden    -Xpreprocessor -fopenmp -std=gnu++14 -MD -MT qiskit/providers/aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o -MF qiskit/providers/aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o.d -o qiskit/providers/aer/backends/wrappers/CMakeFiles/controller_wrappers.dir/bindings.cc.o -c ../../../qiskit/providers/aer/backends/wrappers/bindings.cc
  ../../../qiskit/providers/aer/backends/wrappers/bindings.cc:3:10: fatal error: 'pybind11/pybind11.h' file not found
  #include <pybind11/pybind11.h>
           ^~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  [4/38] Generating CXX source qiskit/providers/aer/openpulse/cy/memory.cxx
  [5/38] Generating CXX source qiskit/providers/aer/openpulse/cy/utils.cxx
  [6/38] Generating CXX source qiskit/providers/aer/openpulse/cy/channel_value.cxx
  [7/38] Generating CXX source qiskit/providers/aer/openpulse/cy/measure.cxx
  [8/38] Building CXX object src/simulators/open_pulse/CMakeFiles/numeric_integrator_wrapper.dir/numeric_integrator_wrapper.cxx.o
  In file included from src/simulators/open_pulse/numeric_integrator_wrapper.cxx:612:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning is a language extension [-Wpedantic]
  #warning "Using deprecated NumPy API, disable it with " \
   ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
  In file included from src/simulators/open_pulse/numeric_integrator_wrapper.cxx:613:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/ufuncobject.h:4:
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_math.h:19:5: warning: 'NPY_INLINE_MATH' is not defined, evaluates to 0 [-Wundef]
  #if NPY_INLINE_MATH
      ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_math.h:263:5: warning: 'HAVE___BUILTIN_ISNAN' is not defined, evaluates to 0 [-Wundef]
  #if HAVE___BUILTIN_ISNAN
      ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_math.h:279:5: warning: 'HAVE___BUILTIN_ISFINITE' is not defined, evaluates to 0 [-Wundef]
  #if HAVE___BUILTIN_ISFINITE
      ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_math.h:294:5: warning: 'HAVE___BUILTIN_ISINF' is not defined, evaluates to 0 [-Wundef]
  #if HAVE___BUILTIN_ISINF
      ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_math.h:642:5: warning: 'NPY_INLINE_MATH' is not defined, evaluates to 0 [-Wundef]
  #if NPY_INLINE_MATH
      ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1705:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1707:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1709:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1711:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1713:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1715:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1717:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1726:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1732:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1738:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1744:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1750:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1756:9: warning: use of the 'fallthrough' attribute is a C++17 extension [-Wc++17-extensions]
          CYTHON_FALLTHROUGH;
          ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:265:36: note: expanded from macro 'CYTHON_FALLTHROUGH'
        #define CYTHON_FALLTHROUGH [[fallthrough]]
                                     ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1814:74: warning: comparing floating point with == or != is unsafe [-Wfloat-equal]
    __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_t); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L1_error)
                                                                 ~~~~~~~~~ ^  ~~~~~~~~~~
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:806:43: note: expanded from macro 'unlikely'
    #define unlikely(x) __builtin_expect(!!(x), 0)
                                            ^
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:5249:18: warning: cast from 'char *' to 'PyObject **' (aka '_object **') increases required alignment from 1 to 8 [-Wcast-align]
      fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:1267:47: note: expanded from macro '__Pyx_PyFrame_GetLocalsplus'
      (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/simulators/open_pulse/numeric_integrator_wrapper.cxx:5678:42: warning: cast from 'char *' to 'PyObject **' (aka '_object **') increases required alignment from 1 to 8 [-Wcast-align]
          dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  23 warnings generated.
  [9/38] Generating CXX source qiskit/providers/aer/openpulse/qutip_lite/cy/spmatfuncs.cxx
  [10/38] Generating CXX source qiskit/providers/aer/openpulse/qutip_lite/cy/spconvert.cxx
  [11/38] Generating CXX source qiskit/providers/aer/openpulse/qutip_lite/cy/spmath.cxx
  [12/38] Generating CXX source qiskit/providers/aer/openpulse/qutip_lite/cy/sparse_utils.cxx
  [13/38] Building CXX object src/simulators/open_pulse/CMakeFiles/numeric_integrator_wrapper.dir/numeric_integrator.cpp.o
  In file included from ../../../src/simulators/open_pulse/numeric_integrator.cpp:9:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning is a language extension [-Wpedantic]
  #warning "Using deprecated NumPy API, disable it with " \
   ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
  In file included from ../../../src/simulators/open_pulse/numeric_integrator.cpp:16:
  ../../../src/simulators/open_pulse/python_to_cpp.hpp:41:1: warning: control may reach end of non-void function [-Wreturn-type]
  };
  ^
  ../../../src/simulators/open_pulse/numeric_integrator.cpp:126:23: warning: unused variable 'numpy_initialized' [-Wunused-variable]
      const static auto numpy_initialized = init_numpy();
                        ^
  4 warnings generated.
  [14/38] Building CXX object src/simulators/open_pulse/CMakeFiles/test_python_to_cpp.dir/test_python_to_cpp.cxx.o
  In file included from src/simulators/open_pulse/test_python_to_cpp.cxx:621:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning is a language extension [-Wpedantic]
  #warning "Using deprecated NumPy API, disable it with " \
   ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
  In file included from src/simulators/open_pulse/test_python_to_cpp.cxx:622:
  In file included from /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/ufuncobject.h:4:
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_math.h:19:5: warning: 'NPY_INLINE_MATH' is not defined, evaluates to 0 [-Wundef]
  #if NPY_INLINE_MATH
      ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_math.h:263:5: warning: 'HAVE___BUILTIN_ISNAN' is not defined, evaluates to 0 [-Wundef]
  #if HAVE___BUILTIN_ISNAN
      ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_math.h:279:5: warning: 'HAVE___BUILTIN_ISFINITE' is not defined, evaluates to 0 [-Wundef]
  #if HAVE___BUILTIN_ISFINITE
      ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_math.h:294:5: warning: 'HAVE___BUILTIN_ISINF' is not defined, evaluates to 0 [-Wundef]
  #if HAVE___BUILTIN_ISINF
      ^
  /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/normal/lib/python3.7/site-packages/numpy/core/include/numpy/npy_math.h:642:5: warning: 'NPY_INLINE_MATH' is not defined, evaluates to 0 [-Wundef]
  #if NPY_INLINE_MATH
      ^
  In file included from src/simulators/open_pulse/test_python_to_cpp.cxx:623:
  In file included from ../../../src/simulators/open_pulse/test_python_to_cpp.hpp:25:
  ../../../src/simulators/open_pulse/python_to_cpp.hpp:41:1: warning: control may reach end of non-void function [-Wreturn-type]
  };
  ^
  src/simulators/open_pulse/test_python_to_cpp.cxx:5508:18: warning: cast from 'char *' to 'PyObject **' (aka '_object **') increases required alignment from 1 to 8 [-Wcast-align]
      fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/simulators/open_pulse/test_python_to_cpp.cxx:1260:47: note: expanded from macro '__Pyx_PyFrame_GetLocalsplus'
      (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/simulators/open_pulse/test_python_to_cpp.cxx:6002:42: warning: cast from 'char *' to 'PyObject **' (aka '_object **') increases required alignment from 1 to 8 [-Wcast-align]
          dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  10 warnings generated.
  ninja: build stopped: subcommand failed.
    File "/private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/overlay/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 577, in setup
      cmkr.make(make_args, env=env)
    File "/private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/overlay/lib/python3.7/site-packages/skbuild/cmaker.py", line 482, in make
      os.path.abspath(CMAKE_BUILD_DIR())))

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

  Traceback (most recent call last):

  An error occurred while building with CMake.
    Command:
      "/private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-build-env-jy4ap9be/overlay/lib/python3.7/site-packages/cmake/data/CMake.app/Contents/bin/cmake" "--build" "." "--target" "install" "--config" "Release" "--"
    Source directory:
      /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-req-build-a5quw6vk
    Working directory:
      /private/var/folders/lp/ftt3j6qs7s90j6h9wszq3jcw0000gn/T/pip-req-build-a5quw6vk/_skbuild/macosx-10.9-x86_64-3.7/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
ERROR: Could not build wheels for qiskit-aer which use PEP 517 and cannot be installed directly
atilag commented 4 years ago

Oh, I don't think building without previously installing dependencies have ever worked, it was a mandatory step. We can surely change setup.py to avoid this and force installing all deps at pip installation time.

atilag commented 4 years ago

The problem here is because the way we look for pybind includes in the build system is not compatible with how pip install works (by creating temporary directories where everything is installed). Will try to look for a fix

chriseclectic commented 4 years ago

I have been playing around with setup.py and can confirm underlying issue is pybind11 headers.

If i modify setup to fix requirements:

requirements = [
    'numpy>=1.13',
    'scipy>=1.0',
    'cython>=0.27.1',
    'pybind11>=2.4'
]

setup_requirements = requirements + [
    'scikit-build',
    'cmake'
]

Calling pip install . fails due to not being able to find hte pybind11 C++ headers. It seems that calling subprocess.call([sys.executable, '-m', 'pip', 'install', 'pybind11>=2.4']) we currently have in the setup.py isn't doing anything (must put the headers in a temporary location that CMake cant find)

Calling pip install pybind11; pip install . works.

We probably need to fix this in the CMakeLists and remove the pip call from setupy.py?

chriseclectic commented 4 years ago

This might be useful. An example pybind11 build project from scikit-build repo:

https://github.com/scikit-build/scikit-build-sample-projects/blob/master/projects/hello-pybind11/CMakeLists.txt

chriseclectic commented 4 years ago

Our travis script should really be updated so that the compile stage tests without installing terra and requirements first (ie python setup.py bdist_wheel in a clean python env)