1{ lib
2, pythonOlder
3, pythonAtLeast
4, buildPythonPackage
5, fetchFromGitHub
6, fetchpatch
7 # Python Inputs
8, fastdtw
9, numpy
10, psutil
11, qiskit-terra
12, scikit-learn
13, sparse
14 # Optional inputs
15, withTorch ? true
16, pytorch
17 # Check Inputs
18, pytestCheckHook
19, ddt
20, pytest-timeout
21, qiskit-aer
22}:
23
24buildPythonPackage rec {
25 pname = "qiskit-machine-learning";
26 version = "0.2.1";
27
28 disabled = pythonOlder "3.6";
29
30 src = fetchFromGitHub {
31 owner = "qiskit";
32 repo = pname;
33 rev = version;
34 sha256 = "sha256-2dfrkNZYSaXwiOCaRrPckq4BllANgc6BogyBcP0vosY=";
35 };
36
37 propagatedBuildInputs = [
38 fastdtw
39 numpy
40 psutil
41 qiskit-terra
42 scikit-learn
43 sparse
44 ] ++ lib.optional withTorch pytorch;
45
46 doCheck = false; # TODO: enable. Tests fail on unstable due to some multithreading issue?
47 checkInputs = [
48 pytestCheckHook
49 pytest-timeout
50 ddt
51 qiskit-aer
52 ];
53
54 pythonImportsCheck = [ "qiskit_machine_learning" ];
55
56 pytestFlagsArray = [
57 "--durations=10"
58 "--showlocals"
59 "-vv"
60 "--ignore=test/connectors/test_torch_connector.py" # TODO: fix, get multithreading errors with python3.9, segfaults
61 ];
62 disabledTests = [
63 # Slow tests >10 s
64 "test_readme_sample"
65 "test_vqr_8"
66 "test_vqr_7"
67 "test_qgan_training_cg"
68 "test_vqc_4"
69 "test_classifier_with_circuit_qnn_and_cross_entropy_4"
70 "test_vqr_4"
71 "test_regressor_with_opflow_qnn_4"
72 "test_qgan_save_model"
73 "test_qgan_training_analytic_gradients"
74 "test_qgan_training_run_algo_numpy"
75 "test_ad_hoc_data"
76 "test_qgan_training"
77 ];
78
79 meta = with lib; {
80 description = "Software for developing quantum computing programs";
81 homepage = "https://qiskit.org";
82 downloadPage = "https://github.com/QISKit/qiskit-optimization/releases";
83 changelog = "https://qiskit.org/documentation/release_notes.html";
84 license = licenses.asl20;
85 maintainers = with maintainers; [ drewrisinger ];
86 };
87}