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