0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

python3Packages.qiskit-aqua: 0.6.6 -> 0.7.0

This commit is contained in:
Drew Risinger 2020-05-11 17:48:09 -04:00 committed by Jon
parent 3a288681c3
commit 2bb34b82a5

View file

@ -2,6 +2,7 @@
, pythonOlder , pythonOlder
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
# , cplex
, cvxopt , cvxopt
, dlx , dlx
, docplex , docplex
@ -10,19 +11,20 @@
, networkx , networkx
, numpy , numpy
, psutil , psutil
, python
, qiskit-ignis , qiskit-ignis
, qiskit-terra , qiskit-terra
, quandl , quandl
, scikitlearn , scikitlearn
# Check Inputs # Check Inputs
, parameterized , ddt
, pytestCheckHook , pytestCheckHook
, qiskit-aer , qiskit-aer
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "qiskit-aqua"; pname = "qiskit-aqua";
version = "0.6.6"; version = "0.7.0";
disabled = pythonOlder "3.5"; disabled = pythonOlder "3.5";
@ -31,11 +33,12 @@ buildPythonPackage rec {
owner = "Qiskit"; owner = "Qiskit";
repo = "qiskit-aqua"; repo = "qiskit-aqua";
rev = version; rev = version;
sha256 = "080m5nsy3ia6bcdypq5d3ijb7762yl1l9llygmxsi6si449zl2cp"; sha256 = "0yykw6k1rb3f2ihcp0y9pb0695mcmy29nyqlj89qs4da0503vxvh";
}; };
# Optional packages: pyscf (see below NOTE) & pytorch. Can install via pip/nix if needed. # Optional packages: pyscf (see below NOTE) & pytorch. Can install via pip/nix if needed.
propagatedBuildInputs = [ propagatedBuildInputs = [
# cplex
cvxopt cvxopt
docplex docplex
dlx # Python Dancing Links package dlx # Python Dancing Links package
@ -57,19 +60,33 @@ buildPythonPackage rec {
# It can also be installed at runtime from the pip wheel. # It can also be installed at runtime from the pip wheel.
# We disable appropriate tests below to allow building without pyscf installed # We disable appropriate tests below to allow building without pyscf installed
# NOTE: we remove cplex b/c we can't build pythonPackages.cplex.
# cplex is only distributed in manylinux1 wheel (no source), and Nix python is not manylinux1 compatible
postPatch = '' postPatch = ''
substituteInPlace setup.py \ substituteInPlace setup.py \
--replace "pyscf; sys_platform == 'linux' or (python_version < '3.8' and sys_platform != 'win32')" "" --replace "pyscf; sys_platform != 'win32'" "" \
--replace "cplex; python_version >= '3.6' and python_version < '3.8'" ""
# Add ImportWarning when running qiskit.chemistry (pyscf is a chemistry package) that pyscf is not included # Add ImportWarning when running qiskit.chemistry (pyscf is a chemistry package) that pyscf is not included
echo -e "\nimport warnings\ntry: import pyscf;\nexcept:\n " \ echo -e "\nimport warnings\ntry: import pyscf;\nexcept ImportError:\n " \
"warnings.warn('pyscf is not supported on Nixpkgs so some qiskit features will fail." \ "warnings.warn('pyscf is not supported on Nixpkgs so some qiskit features will fail." \
"You must install it yourself via pip or add it to your environment from the Nix User Repository." \ "You must install it yourself via pip or add it to your environment from the Nix User Repository." \
"See https://github.com/NixOS/nixpkgs/pull/83447 for details', ImportWarning)\n" \ "See https://github.com/NixOS/nixpkgs/pull/83447 for details', ImportWarning)\n" \
>> qiskit/chemistry/__init__.py >> qiskit/chemistry/__init__.py
# Add ImportWarning when running qiskit.optimization that cplex (optimization package) is not included
echo -e "\nimport warnings\ntry: import cplex;\nexcept ImportError:\n " \
"warnings.warn('cplex is not supported on Nixpkgs so some qiskit features will fail." \
"You must install it yourself via pip or add it to your environment from the Nix User Repository." \
"', ImportWarning)\n" \
>> qiskit/optimization/__init__.py
''; '';
checkInputs = [ parameterized qiskit-aer pytestCheckHook ]; postInstall = "rm -rf $out/${python.sitePackages}/docs"; # Remove docs dir b/c it can cause conflicts.
checkInputs = [ ddt qiskit-aer pytestCheckHook ];
dontUseSetuptoolsCheck = true; dontUseSetuptoolsCheck = true;
pythonImportsCheck = [ pythonImportsCheck = [
"qiskit.aqua" "qiskit.aqua"
@ -84,42 +101,35 @@ buildPythonPackage rec {
"--ignore=test/chemistry/test_qeom_ee.py" "--ignore=test/chemistry/test_qeom_ee.py"
"--ignore=test/chemistry/test_qeom_vqe.py" "--ignore=test/chemistry/test_qeom_vqe.py"
"--ignore=test/chemistry/test_vqe_uccsd_adapt.py" "--ignore=test/chemistry/test_vqe_uccsd_adapt.py"
# Following tend to be slow tests, all pass
"--ignore=test/aqua/test_vqc.py"
"--ignore=test/aqua/test_hhl.py"
"--ignore=test/aqua/test_qgan.py"
"--ignore=test/aqua/test_mcr.py"
"--ignore=test/aqua/test_mcu1.py"
"--ignore=test/aqua/test_vqe.py"
]; ];
disabledTests = [ disabledTests = [
# Disabled due to missing pyscf # Disabled due to missing pyscf
"test_validate" # test/chemistry/test_inputparser.py "test_validate" # test/chemistry/test_inputparser.py
# Disabling slow tests > 10 seconds # Disabling slow tests > 10 seconds
"test_clique_vqe" "TestVQE"
"test_delta_3_qasm" "TestVQC"
"test_evaluate_qasm_mode" "TestQSVM"
"test_evolve_1_suzuki"
"test_exact_cover_vqe"
"test_exchangedata"
"test_expected_value_0_statevector"
"test_expected_value_1_qasm"
"test_expected_value_2_statevector"
"test_graph_partition_vqe" "test_graph_partition_vqe"
"test_lookup_rotation" "TestLookupRotation"
"test_mct_with_dirty_ancillae_15" "_vqe"
"test_mcrz_11" "TestHHL"
"TestQGAN"
"test_evaluate_qasm_mode"
"test_measurement_error_mitigation_auto_refresh" "test_measurement_error_mitigation_auto_refresh"
"test_qgan_training" "test_exchangedata"
"test_qsvm_multiclass"
"test_shor_factoring_0"
"test_vertex_cover_vqe"
"test_vqc_with_raw_feature_vector_on_wine"
"test_vqe_2_iqpe"
"test_vqe_qasm"
"test_wikipedia" "test_wikipedia"
"test_shor_factoring_1__15___qasm_simulator____3__5__"
"test_readme_sample"
"test_ecev"
"test_expected_value"
"test_qubo_gas_int_paper_example"
"test_shor_no_factors_1_5"
"test_shor_no_factors_2_7"
"test_evolve_2___suzuki___1__3_"
"test_delta_4"
"test_swaprz"
"test_deprecated_algo_result"
]; ];
meta = with lib; { meta = with lib; {