From 35b9c063c226a33fbedc09d69b2de3747c6120ce Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Tue, 1 Jun 2021 18:06:33 -0400 Subject: [PATCH 1/8] python3Packages.retworkx: 0.8.0 -> 0.9.0 Also fixes retworkx Darwin build. Fixes linker error for retworkx that required libiconv. Error log: error: linking with `/nix/store/47vpv5i10dwfg1cf5wca1k40f982g5fm-clang-wrapper-7.1.0/bin/cc` failed: exit code: 1 ... ld: library not found for -liconv clang-7: error: linker command failed with exit code 1 (use -v to see invocation) Also fix tests running on build, that didn't get converted when switched to the new way of running Cargo builds for python packages. --- .../python-modules/retworkx/default.nix | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/retworkx/default.nix b/pkgs/development/python-modules/retworkx/default.nix index c4b7a6323e4dd..f4490c72876dd 100644 --- a/pkgs/development/python-modules/retworkx/default.nix +++ b/pkgs/development/python-modules/retworkx/default.nix @@ -1,18 +1,23 @@ { lib +, stdenv , buildPythonPackage , pythonOlder , rustPlatform , fetchFromGitHub - +, libiconv # Check inputs , pytestCheckHook +, fixtures +, graphviz +, matplotlib , networkx , numpy +, pydot }: buildPythonPackage rec { pname = "retworkx"; - version = "0.8.0"; + version = "0.9.0"; format = "pyproject"; disabled = pythonOlder "3.6"; @@ -20,22 +25,29 @@ buildPythonPackage rec { owner = "Qiskit"; repo = "retworkx"; rev = version; - sha256 = "0plpri6a3d6f1000kmcah9066vq2i37d14bdf8sm96493fhpqhrd"; + hash = "sha256-1W7DexS+ECAPsxyZAF36xcEguFkjUMX9lDBylNVPqyk="; }; cargoDeps = rustPlatform.fetchCargoTarball { inherit src; name = "${pname}-${version}"; - hash = "sha256-+k779gmge8wDdoZrWn9ND47kUqt7pqe75Zuj2Byfefo="; + hash = "sha256-y5l7jqrlk3ONHefZPS31IvcaO9ttXWLM7fIUmNVwbco="; }; nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ]; - # Needed b/c need to check AFTER python wheel is installed (using Rust Build, not buildPythonPackage) - doCheck = false; - doInstallCheck = true; + buildInputs = lib.optionals stdenv.isDarwin [ libiconv ]; - installCheckInputs = [ pytestCheckHook networkx numpy ]; + pythonImportsCheck = [ "retworkx" ]; + checkInputs = [ + pytestCheckHook + fixtures + graphviz + matplotlib + networkx + numpy + pydot + ]; preCheck = '' export TESTDIR=$(mktemp -d) From bc9d05509a3e7fa9c0fbee0ead07c3934432a09e Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Tue, 27 Apr 2021 14:17:52 -0400 Subject: [PATCH 2/8] python3Packages.yfinance: 0.1.56 -> 0.1.59 --- pkgs/development/python-modules/yfinance/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/yfinance/default.nix b/pkgs/development/python-modules/yfinance/default.nix index bceac92d79ed0..81250f98a64d2 100644 --- a/pkgs/development/python-modules/yfinance/default.nix +++ b/pkgs/development/python-modules/yfinance/default.nix @@ -9,12 +9,12 @@ buildPythonPackage rec { pname = "yfinance"; - version = "0.1.56"; + version = "0.1.59"; # GitHub source releases aren't tagged src = fetchPypi { inherit pname version; - sha256 = "a6d4c7b939fdd48d983556501f5b387e20aaef86afc8e6ba6f91a49a7e22d2dd"; + sha256 = "fe4dc46807eceadc6604bf51ece7297b752dc5402a38a87385094fbfc7565fa0"; }; propagatedBuildInputs = [ From d173e91589a3e2604dfbadbf8d7a5b8e1089d842 Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Tue, 27 Apr 2021 14:21:34 -0400 Subject: [PATCH 3/8] python3Packages.qiskit-terra: 0.17.0 -> 0.17.4 Also unbreak build on master by disabling tests that compare visual matplotlib images. Also remove force deletes from postCheck. --- .../python-modules/qiskit-terra/default.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/qiskit-terra/default.nix b/pkgs/development/python-modules/qiskit-terra/default.nix index a5faf69f942e4..8b83c506808ef 100644 --- a/pkgs/development/python-modules/qiskit-terra/default.nix +++ b/pkgs/development/python-modules/qiskit-terra/default.nix @@ -1,4 +1,5 @@ { lib +, stdenv , pythonOlder , buildPythonPackage , fetchFromGitHub @@ -56,7 +57,7 @@ in buildPythonPackage rec { pname = "qiskit-terra"; - version = "0.17.0"; + version = "0.17.4"; disabled = pythonOlder "3.6"; @@ -64,7 +65,7 @@ buildPythonPackage rec { owner = "Qiskit"; repo = pname; rev = version; - hash = "sha256-LbNbaHAWAVG5YLc9juuwcOlrREBW6OjEl7VPtACfl3I="; + hash = "sha256-JyNuke+XPqjLVZbvPud9Y7k0+EmvETVKcOYcDldBiVo="; }; nativeBuildInputs = [ cython ]; @@ -106,11 +107,17 @@ buildPythonPackage rec { "test/python/classical_function_compiler/" ]; disabledTests = [ + # Not working on matplotlib >= 3.4.0, checks images match. + "test_plot_circuit_layout" + # Flaky tests "test_cx_equivalence" "test_pulse_limits" + "test_1q_random" ] ++ lib.optionals (!withClassicalFunctionCompiler) [ "TestPhaseOracle" + ] ++ lib.optionals stdenv.isAarch64 [ + "test_circuit_init" # failed on aarch64, https://gist.github.com/r-rmcgibbo/c2e173d43ced4f6954811004f6b5b842 ] # Disabling slow tests for build constraints ++ [ @@ -155,8 +162,8 @@ buildPythonPackage rec { pushd $PACKAGEDIR ''; postCheck = '' - rm -rf test - rm -rf examples + rm -r test + rm -r examples popd ''; From bf1bad92637565f6787b62ca5e58fc356cd3ce60 Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Tue, 27 Apr 2021 14:23:15 -0400 Subject: [PATCH 4/8] python3Packages.qiskit-ibmq-provider: 0.12.2 -> 0.13.1 --- .../python-modules/qiskit-ibmq-provider/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/qiskit-ibmq-provider/default.nix b/pkgs/development/python-modules/qiskit-ibmq-provider/default.nix index 80f060c668156..aa02de42fb329 100644 --- a/pkgs/development/python-modules/qiskit-ibmq-provider/default.nix +++ b/pkgs/development/python-modules/qiskit-ibmq-provider/default.nix @@ -39,7 +39,7 @@ let in buildPythonPackage rec { pname = "qiskit-ibmq-provider"; - version = "0.12.2"; + version = "0.13.1"; disabled = pythonOlder "3.6"; @@ -47,7 +47,7 @@ buildPythonPackage rec { owner = "Qiskit"; repo = pname; rev = version; - sha256 = "0yil363mqssq0453nrwxgkjivzk3a4jgbnaf21bp7lwfcl2jdhqm"; + hash = "sha256-DlHlXncttzGo4uVoh2aQ7urW6krN3ej2sJ/EwuxeF2I="; }; propagatedBuildInputs = [ @@ -83,7 +83,9 @@ buildPythonPackage rec { # Skip tests that rely on internet access (mostly to IBM Quantum Experience cloud). # Options defined in qiskit.terra.test.testing_options.py::get_test_options - QISKIT_TESTS = "skip_online"; + preCheck = '' + export QISKIT_TESTS=skip_online + ''; meta = with lib; { description = "Qiskit provider for accessing the quantum devices and simulators at IBMQ"; From 2d90781e4d78bf753e8e5285002b1bce3f5fa101 Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Wed, 19 May 2021 18:13:40 -0400 Subject: [PATCH 5/8] python3Packages.qiskit-aer: 0.8.0 -> 0.8.2 Use a patch submitted via PR instead of custom substitute. Remove pybind11 install requirement, as requested by @dotlambda --- .../python-modules/qiskit-aer/default.nix | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/qiskit-aer/default.nix b/pkgs/development/python-modules/qiskit-aer/default.nix index 54de098bdc46c..89041f7508df3 100644 --- a/pkgs/development/python-modules/qiskit-aer/default.nix +++ b/pkgs/development/python-modules/qiskit-aer/default.nix @@ -2,6 +2,7 @@ , pythonOlder , buildPythonPackage , fetchFromGitHub +, fetchpatch # C Inputs , blas , catch2 @@ -27,7 +28,7 @@ buildPythonPackage rec { pname = "qiskit-aer"; - version = "0.8.0"; + version = "0.8.2"; format = "pyproject"; disabled = pythonOlder "3.6"; @@ -36,13 +37,30 @@ buildPythonPackage rec { owner = "Qiskit"; repo = "qiskit-aer"; rev = version; - hash = "sha256-CWF3ehLs0HBXnYH11r+2CQwIcxddAfQm3ulAf1agl/o="; + hash = "sha256-7NWM7qpMQ3vA6p0dhEPnkBjsPMdhceYTYcAD4tsClf0="; }; + patches = [ + (fetchpatch { + # https://github.com/Qiskit/qiskit-aer/pull/1250 + name = "qiskit-aer-pr-1250-native-cmake_dl_libs.patch"; + url = "https://github.com/Qiskit/qiskit-aer/commit/2bf04ade3e5411776817706cf82cc67a3b3866f6.patch"; + sha256 = "0ldwzxxfgaad7ifpci03zfdaj0kqj0p3h94qgshrd2953mf27p6z"; + }) + ]; + # Remove need for cmake python package + # pybind11 shouldn't be an install requirement, just build requirement. + postPatch = '' + substituteInPlace setup.py \ + --replace "'cmake!=3.17,!=3.17.0'," "" \ + --replace "'pybind11>=2.6'" "" + ''; + nativeBuildInputs = [ cmake ninja scikit-build + pybind11 ]; buildInputs = [ @@ -58,14 +76,8 @@ buildPythonPackage rec { cvxpy cython # generates some cython files at runtime that need to be cython-ized numpy - pybind11 ]; - # tries to install pypi cmake package, not needed - postPatch = '' - substituteInPlace setup.py --replace "'cmake!=3.17,!=3.17.0'," "" - ''; - # Disable using conan for build preBuild = '' export DISABLE_CONAN=1 From 7af89007ad2913453646de12597eaf415eb565f0 Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Tue, 4 May 2021 13:06:19 -0400 Subject: [PATCH 6/8] python3Packages.qiskit-ignis: fix aarch64 build Also remove unused patch & unneeded docs delete (they're not in $out). --- .../python-modules/qiskit-ignis/default.nix | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/qiskit-ignis/default.nix b/pkgs/development/python-modules/qiskit-ignis/default.nix index 996259f683b49..f7ebbee39f80f 100644 --- a/pkgs/development/python-modules/qiskit-ignis/default.nix +++ b/pkgs/development/python-modules/qiskit-ignis/default.nix @@ -1,8 +1,8 @@ { lib +, stdenv , pythonOlder , buildPythonPackage , fetchFromGitHub -, python , numpy , qiskit-terra , scikit-learn @@ -35,12 +35,6 @@ buildPythonPackage rec { hash = "sha256-L5fwCMsN03ojiDvKIyqsGfUnwej1P7bpyHlL6mu7nh0="; }; - # hacky, fix https://github.com/Qiskit/qiskit-ignis/issues/532. - # TODO: remove on qiskit-ignis v0.5.2 - postPatch = '' - substituteInPlace qiskit/ignis/mitigation/expval/base_meas_mitigator.py --replace "plt.axes" "'plt.axes'" - ''; - propagatedBuildInputs = [ numpy qiskit-terra @@ -49,12 +43,13 @@ buildPythonPackage rec { ] ++ lib.optionals (withCvx) [ cvxpy ] ++ lib.optionals (withVisualization) [ matplotlib ] ++ lib.optionals (withJit) [ numba ]; - postInstall = "rm -rf $out/${python.sitePackages}/docs"; # this dir can create conflicts # Tests pythonImportsCheck = [ "qiskit.ignis" ]; dontUseSetuptoolsCheck = true; - preCheck = "export HOME=$TMPDIR"; + preCheck = '' + export HOME=$TMPDIR + ''; checkInputs = [ pytestCheckHook ddt @@ -63,7 +58,8 @@ buildPythonPackage rec { ]; disabledTests = [ "test_tensored_meas_cal_on_circuit" # Flaky test, occasionally returns result outside bounds - "test_qv_fitter" # execution hangs, ran for several minutes + ] ++ lib.optionals stdenv.isAarch64 [ + "test_fitters" # Fails check that arrays are close. Might be due to aarch64 math issues. ]; meta = with lib; { From 6171c77ad3c42b840fe56796c40cf932139c0950 Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Tue, 27 Apr 2021 14:29:50 -0400 Subject: [PATCH 7/8] python3Packages.qiskit-aqua: 0.9.0 -> 0.9.1 Remove unneeded docs delete, they're no longer in $out. --- .../python-modules/qiskit-aqua/default.nix | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/qiskit-aqua/default.nix b/pkgs/development/python-modules/qiskit-aqua/default.nix index 3233e435f071f..7069629470cd8 100644 --- a/pkgs/development/python-modules/qiskit-aqua/default.nix +++ b/pkgs/development/python-modules/qiskit-aqua/default.nix @@ -10,7 +10,6 @@ , networkx , numpy , psutil -, python , qiskit-ignis , qiskit-terra , quandl @@ -34,7 +33,7 @@ buildPythonPackage rec { pname = "qiskit-aqua"; - version = "0.9.0"; + version = "0.9.1"; disabled = pythonOlder "3.6"; @@ -43,7 +42,7 @@ buildPythonPackage rec { owner = "Qiskit"; repo = "qiskit-aqua"; rev = version; - hash = "sha256-knue9uJih72UQHsvfXZ9AA94mol4ERa9Lo/GMcp+2hA="; + hash = "sha256-fptyqPrkUgl3UjtlEmDYORdX/SsONxWozQGEs/EahmU="; }; # Optional packages: pyscf (see below NOTE) & pytorch. Can install via pip/nix if needed. @@ -97,8 +96,6 @@ buildPythonPackage rec { >> qiskit/optimization/__init__.py ''; - postInstall = "rm -rf $out/${python.sitePackages}/docs"; # Remove docs dir b/c it can cause conflicts. - checkInputs = [ pytestCheckHook ddt @@ -123,9 +120,6 @@ buildPythonPackage rec { "--ignore=test/chemistry/test_bopes_sampler.py" ]; disabledTests = [ - # Disabled due to missing pyscf - "test_validate" # test/chemistry/test_inputparser.py - # Online tests "test_exchangedata" "test_yahoo" @@ -163,6 +157,8 @@ buildPythonPackage rec { "test_eoh" "test_qasm_5" "test_uccsd_hf" + ] ++ lib.optionals (!withPyscf) [ + "test_validate" # test/chemistry/test_inputparser.py ]; meta = with lib; { From bb6aec6f49196b58e31963759de0a6021e153a8a Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Tue, 27 Apr 2021 14:31:29 -0400 Subject: [PATCH 8/8] python3Packages.qiskit: 0.25.0 -> 0.26.2 Add optional subpackages as arguments. Most of these are not in nixpkgs, but can be found in https://github.com/drewrisinger/nur-packages/. --- pkgs/development/python-modules/qiskit/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/qiskit/default.nix b/pkgs/development/python-modules/qiskit/default.nix index d2866d41c3ab2..6cc24be1958a9 100644 --- a/pkgs/development/python-modules/qiskit/default.nix +++ b/pkgs/development/python-modules/qiskit/default.nix @@ -15,7 +15,7 @@ buildPythonPackage rec { pname = "qiskit"; # NOTE: This version denotes a specific set of subpackages. See https://qiskit.org/documentation/release_notes.html#version-history - version = "0.25.0"; + version = "0.26.2"; disabled = pythonOlder "3.6"; @@ -23,7 +23,7 @@ buildPythonPackage rec { owner = "qiskit"; repo = "qiskit"; rev = version; - hash = "sha256-pJM6d3AyFs9AexvQXG+8QQ4zwpFisJC16iBFR9gNSk0="; + hash = "sha256-QYWKKS7e/uCt5puWV4jA9Emp7M4Cyv2RUCxilbChWhw="; }; propagatedBuildInputs = [