at 24.11-pre 159 lines 3.5 kB view raw
1{ 2 stdenv, 3 lib, 4 pythonOlder, 5 buildPythonPackage, 6 fetchFromGitHub, 7 fetchpatch, 8 # C Inputs 9 blas, 10 catch2, 11 cmake, 12 cython, 13 fmt, 14 muparserx, 15 ninja, 16 nlohmann_json, 17 spdlog, 18 # Python Inputs 19 cvxpy, 20 numpy, 21 pybind11, 22 scikit-build, 23 # Check Inputs 24 pytestCheckHook, 25 ddt, 26 fixtures, 27 pytest-timeout, 28 qiskit-terra, 29 setuptools, 30 testtools, 31}: 32 33buildPythonPackage rec { 34 pname = "qiskit-aer"; 35 version = "0.13.3"; 36 format = "pyproject"; 37 38 disabled = pythonOlder "3.6"; 39 40 src = fetchFromGitHub { 41 owner = "Qiskit"; 42 repo = "qiskit-aer"; 43 rev = "refs/tags/${version}"; 44 hash = "sha256-xE5P4o6/I8Y/trK0e8GQ0oAOAyMvYWfzyuVvAoZExwk="; 45 }; 46 47 postPatch = '' 48 substituteInPlace setup.py \ 49 --replace "'cmake!=3.17,!=3.17.0'," "" \ 50 --replace "'pybind11', min_version='2.6'" "'pybind11'" \ 51 --replace "pybind11>=2.6" "pybind11" \ 52 --replace "scikit-build>=0.11.0" "scikit-build" \ 53 --replace "min_version='0.11.0'" "" 54 ''; 55 56 nativeBuildInputs = [ 57 cmake 58 ninja 59 scikit-build 60 ]; 61 62 buildInputs = [ 63 blas 64 catch2 65 nlohmann_json 66 fmt 67 muparserx 68 spdlog 69 ]; 70 71 propagatedBuildInputs = [ 72 cvxpy 73 cython # generates some cython files at runtime that need to be cython-ized 74 numpy 75 pybind11 76 ]; 77 78 preBuild = '' 79 export DISABLE_CONAN=1 80 ''; 81 82 dontUseCmakeConfigure = true; 83 84 # *** Testing *** 85 pythonImportsCheck = [ 86 "qiskit.providers.aer" 87 "qiskit.providers.aer.backends.qasm_simulator" 88 "qiskit.providers.aer.backends.controller_wrappers" # Checks C++ files built correctly. Only exists if built & moved to output 89 ]; 90 91 disabledTests = [ 92 # these tests don't work with cvxpy >= 1.1.15 93 "test_clifford" 94 "test_approx_random" 95 "test_snapshot" # TODO: these ~30 tests fail on setup due to pytest fixture issues? 96 "test_initialize_2" # TODO: simulations appear incorrect, off by >10%. 97 "test_pauli_error_2q_gate_from_string_1qonly" 98 99 # these fail for some builds. Haven't been able to reproduce error locally. 100 "test_kraus_gate_noise" 101 "test_backend_method_clifford_circuits_and_kraus_noise" 102 "test_backend_method_nonclifford_circuit_and_kraus_noise" 103 "test_kraus_noise_fusion" 104 105 # Slow tests 106 "test_paulis_1_and_2_qubits" 107 "test_3d_oscillator" 108 "_057" 109 "_136" 110 "_137" 111 "_139" 112 "_138" 113 "_140" 114 "_141" 115 "_143" 116 "_144" 117 "test_sparse_output_probabilities" 118 "test_reset_2_qubit" 119 120 # Fails with 0.10.4 121 "test_extended_stabilizer_sparse_output_probs" 122 ]; 123 124 nativeCheckInputs = [ 125 pytestCheckHook 126 ddt 127 fixtures 128 pytest-timeout 129 qiskit-terra 130 testtools 131 ]; 132 133 pytestFlagsArray = [ 134 "--timeout=30" 135 "--durations=10" 136 ]; 137 138 preCheck = '' 139 # Tests include a compiled "circuit" which is auto-built in $HOME 140 export HOME=$(mktemp -d) 141 # move tests b/c by default try to find (missing) cython-ized code in /build/source dir 142 cp -r $TMP/$sourceRoot/test $HOME 143 144 # Add qiskit-aer compiled files to cython include search 145 pushd $HOME 146 ''; 147 148 postCheck = "popd"; 149 150 meta = with lib; { 151 broken = true; 152 description = "High performance simulators for Qiskit"; 153 homepage = "https://qiskit.org/aer"; 154 downloadPage = "https://github.com/QISKit/qiskit-aer/releases"; 155 changelog = "https://qiskit.org/documentation/release_notes.html"; 156 license = licenses.asl20; 157 maintainers = with maintainers; [ drewrisinger ]; 158 }; 159}