diff --git a/pkgs/development/python-modules/qiskit-aer/default.nix b/pkgs/development/python-modules/qiskit-aer/default.nix index 3f0439efc7a83d..8e73e942be92ff 100644 --- a/pkgs/development/python-modules/qiskit-aer/default.nix +++ b/pkgs/development/python-modules/qiskit-aer/default.nix @@ -6,6 +6,9 @@ , cmake , cvxpy , cython +, muparserx +, ninja +, nlohmann_json , numpy , openblas , pybind11 @@ -19,7 +22,7 @@ buildPythonPackage rec { pname = "qiskit-aer"; - version = "0.5.2"; + version = "0.6.1"; disabled = pythonOlder "3.5"; @@ -27,18 +30,20 @@ buildPythonPackage rec { owner = "Qiskit"; repo = "qiskit-aer"; rev = version; - fetchSubmodules = true; # fetch muparserx and other required libraries - sha256 = "0vw6b69h8pvzxhaz3k8sg9ac792gz3kklfv0izs6ra83y1dfwhjz"; + sha256 = "1fnv11diis0as8zcc57mamz0gbjd6vj7nw3arxzvwa77ja803sr4"; }; nativeBuildInputs = [ cmake + ninja scikit-build ]; buildInputs = [ openblas spdlog + nlohmann_json + muparserx ]; propagatedBuildInputs = [ @@ -48,10 +53,10 @@ buildPythonPackage rec { pybind11 ]; - postPatch = '' - # remove dependency on PyPi cmake package, which isn't in Nixpkgs - substituteInPlace setup.py --replace "'cmake!=3.17,!=3.17.0'" "" - ''; + patches = [ + # TODO: remove in favor of qiskit-aer PR #877 patch once accepted/stable + ./remove-conan-install.patch + ]; dontUseCmakeConfigure = true; @@ -60,11 +65,6 @@ buildPythonPackage rec { "-DAER_THRUST_BACKEND=OMP" ]; - # Needed to find qiskit.providers.aer modules in cython. This exists in GitHub, don't know why it isn't copied by default - postFixup = '' - touch $out/${python.sitePackages}/qiskit/__init__.pxd - ''; - # *** Testing *** pythonImportsCheck = [ @@ -77,11 +77,6 @@ buildPythonPackage rec { pytestCheckHook ]; dontUseSetuptoolsCheck = true; # Otherwise runs tests twice - disabledTests = [ - # broken with cvxpy >= 1.1.0, see https://github.com/Qiskit/qiskit-aer/issues/779. - # TODO: Remove once resolved, probably next qiskit-aer version - "test_clifford" - ]; preCheck = '' # Tests include a compiled "circuit" which is auto-built in $HOME @@ -100,11 +95,8 @@ buildPythonPackage rec { description = "High performance simulators for Qiskit"; homepage = "https://qiskit.org/aer"; downloadPage = "https://github.com/QISKit/qiskit-aer/releases"; + changelog = "https://qiskit.org/documentation/release_notes.html"; license = licenses.asl20; maintainers = with maintainers; [ drewrisinger ]; - # Doesn't build on aarch64 (libmuparserx issue). - # Can fix by building muparserx from source (https://github.com/beltoforion/muparserx) - # or in future updates (e.g. Raspberry Pi enabled via https://github.com/Qiskit/qiskit-aer/pull/651 & https://github.com/Qiskit/qiskit-aer/pull/660) - platforms = platforms.x86_64; }; } diff --git a/pkgs/development/python-modules/qiskit-aer/remove-conan-install.patch b/pkgs/development/python-modules/qiskit-aer/remove-conan-install.patch new file mode 100644 index 00000000000000..1c5ae87b082feb --- /dev/null +++ b/pkgs/development/python-modules/qiskit-aer/remove-conan-install.patch @@ -0,0 +1,63 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index efeacfc..77bd6bd 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -121,7 +121,11 @@ endif() + # Looking for external libraries + # + +-setup_conan() ++find_package(muparserx REQUIRED) ++find_package(nlohmann_json REQUIRED) ++find_package(spdlog REQUIRED) ++# for tests only ++find_package(catch2) + + # If we do not set them with a space CMake fails afterwards if nothing is set for this vars! + set(AER_LINKER_FLAGS " ") +@@ -269,16 +273,16 @@ endif() + set(AER_LIBRARIES + ${AER_LIBRARIES} + ${BLAS_LIBRARIES} +- CONAN_PKG::nlohmann_json ++ nlohmann_json + Threads::Threads +- CONAN_PKG::spdlog ++ spdlog + ${DL_LIB} + ${THRUST_DEPENDANT_LIBS}) + + set(AER_COMPILER_DEFINITIONS ${AER_COMPILER_DEFINITIONS} ${CONAN_DEFINES}) + # Cython build is only enabled if building through scikit-build. + if(SKBUILD) # Terra Addon build +- set(AER_LIBRARIES ${AER_LIBRARIES} CONAN_PKG::muparserx) ++ set(AER_LIBRARIES ${AER_LIBRARIES} muparserx) + add_subdirectory(qiskit/providers/aer/pulse/qutip_extra_lite/cy) + add_subdirectory(qiskit/providers/aer/backends/wrappers) + add_subdirectory(src/open_pulse) +diff --git a/setup.py b/setup.py +index fd71e9f..1561cc4 100644 +--- a/setup.py ++++ b/setup.py +@@ -11,12 +11,6 @@ import inspect + + PACKAGE_NAME = os.getenv('QISKIT_AER_PACKAGE_NAME', 'qiskit-aer') + +-try: +- from conans import client +-except ImportError: +- subprocess.call([sys.executable, '-m', 'pip', 'install', 'conan']) +- from conans import client +- + try: + from skbuild import setup + except ImportError: +@@ -46,8 +40,6 @@ common_requirements = [ + + setup_requirements = common_requirements + [ + 'scikit-build', +- 'cmake!=3.17,!=3.17.0', +- 'conan>=1.22.2' + ] + + requirements = common_requirements + ['qiskit-terra>=0.12.0']