Merge master into staging-next

This commit is contained in:
Frederik Rietdijk
2020-08-26 08:42:36 +02:00
86 changed files with 2222 additions and 293 deletions

View File

@@ -0,0 +1,25 @@
{ lib
, buildPythonPackage
, fetchPypi
}:
buildPythonPackage rec {
pname = "multitasking";
version = "0.0.9";
# GitHub source releases aren't tagged
src = fetchPypi {
inherit pname version;
sha256 = "b59d99f709d2e17d60ccaa2be09771b6e9ed9391c63f083c0701e724f624d2e0";
};
doCheck = false; # No tests included
pythonImportsCheck = [ "multitasking" ];
meta = with lib; {
description = "Non-blocking Python methods using decorators";
homepage = "https://github.com/ranaroussi/multitasking";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};
}

View File

@@ -6,13 +6,13 @@
buildPythonPackage rec {
pname = "pylatexenc";
version = "2.4";
version = "2.7";
src = fetchFromGitHub {
owner = "phfaist";
repo = "pylatexenc";
rev = "v${version}";
sha256 = "0i4frypbv90mjir8bkp03cwkvwhgvc9p3fw6q2jz1dn7fw94v2rv";
sha256 = "1hpcwbknfah3mky2m4asw15b9qdvv4k5ni0js764n1jpi83m1zgk";
};
pythonImportsCheck = [ "pylatexenc" ];
@@ -26,4 +26,4 @@ buildPythonPackage rec {
license = licenses.mit;
maintainers = with maintainers; [ drewrisinger ];
};
}
}

View File

@@ -6,6 +6,9 @@
, cmake
, cvxpy
, cython
, muparserx
, ninja
, nlohmann_json
, numpy
, openblas
, pybind11
@@ -19,7 +22,7 @@
buildPythonPackage rec {
pname = "qiskit-aer";
version = "0.5.2";
version = "0.6.1";
disabled = pythonOlder "3.5";
@@ -27,18 +30,20 @@ buildPythonPackage rec {
owner = "Qiskit";
repo = "qiskit-aer";
rev = version;
fetchSubmodules = true; # fetch muparserx and other required libraries
sha256 = "0vw6b69h8pvzxhaz3k8sg9ac792gz3kklfv0izs6ra83y1dfwhjz";
sha256 = "1fnv11diis0as8zcc57mamz0gbjd6vj7nw3arxzvwa77ja803sr4";
};
nativeBuildInputs = [
cmake
ninja
scikit-build
];
buildInputs = [
openblas
spdlog
nlohmann_json
muparserx
];
propagatedBuildInputs = [
@@ -48,10 +53,10 @@ buildPythonPackage rec {
pybind11
];
postPatch = ''
# remove dependency on PyPi cmake package, which isn't in Nixpkgs
substituteInPlace setup.py --replace "'cmake!=3.17,!=3.17.0'" ""
'';
patches = [
# TODO: remove in favor of qiskit-aer PR #877 patch once accepted/stable
./remove-conan-install.patch
];
dontUseCmakeConfigure = true;
@@ -60,11 +65,6 @@ buildPythonPackage rec {
"-DAER_THRUST_BACKEND=OMP"
];
# Needed to find qiskit.providers.aer modules in cython. This exists in GitHub, don't know why it isn't copied by default
postFixup = ''
touch $out/${python.sitePackages}/qiskit/__init__.pxd
'';
# *** Testing ***
pythonImportsCheck = [
@@ -77,11 +77,6 @@ buildPythonPackage rec {
pytestCheckHook
];
dontUseSetuptoolsCheck = true; # Otherwise runs tests twice
disabledTests = [
# broken with cvxpy >= 1.1.0, see https://github.com/Qiskit/qiskit-aer/issues/779.
# TODO: Remove once resolved, probably next qiskit-aer version
"test_clifford"
];
preCheck = ''
# Tests include a compiled "circuit" which is auto-built in $HOME
@@ -100,11 +95,8 @@ buildPythonPackage rec {
description = "High performance simulators for Qiskit";
homepage = "https://qiskit.org/aer";
downloadPage = "https://github.com/QISKit/qiskit-aer/releases";
changelog = "https://qiskit.org/documentation/release_notes.html";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
# Doesn't build on aarch64 (libmuparserx issue).
# Can fix by building muparserx from source (https://github.com/beltoforion/muparserx)
# or in future updates (e.g. Raspberry Pi enabled via https://github.com/Qiskit/qiskit-aer/pull/651 & https://github.com/Qiskit/qiskit-aer/pull/660)
platforms = platforms.x86_64;
};
}

View File

@@ -0,0 +1,63 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index efeacfc..77bd6bd 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,7 +121,11 @@ endif()
# Looking for external libraries
#
-setup_conan()
+find_package(muparserx REQUIRED)
+find_package(nlohmann_json REQUIRED)
+find_package(spdlog REQUIRED)
+# for tests only
+find_package(catch2)
# If we do not set them with a space CMake fails afterwards if nothing is set for this vars!
set(AER_LINKER_FLAGS " ")
@@ -269,16 +273,16 @@ endif()
set(AER_LIBRARIES
${AER_LIBRARIES}
${BLAS_LIBRARIES}
- CONAN_PKG::nlohmann_json
+ nlohmann_json
Threads::Threads
- CONAN_PKG::spdlog
+ spdlog
${DL_LIB}
${THRUST_DEPENDANT_LIBS})
set(AER_COMPILER_DEFINITIONS ${AER_COMPILER_DEFINITIONS} ${CONAN_DEFINES})
# Cython build is only enabled if building through scikit-build.
if(SKBUILD) # Terra Addon build
- set(AER_LIBRARIES ${AER_LIBRARIES} CONAN_PKG::muparserx)
+ set(AER_LIBRARIES ${AER_LIBRARIES} muparserx)
add_subdirectory(qiskit/providers/aer/pulse/qutip_extra_lite/cy)
add_subdirectory(qiskit/providers/aer/backends/wrappers)
add_subdirectory(src/open_pulse)
diff --git a/setup.py b/setup.py
index fd71e9f..1561cc4 100644
--- a/setup.py
+++ b/setup.py
@@ -11,12 +11,6 @@ import inspect
PACKAGE_NAME = os.getenv('QISKIT_AER_PACKAGE_NAME', 'qiskit-aer')
-try:
- from conans import client
-except ImportError:
- subprocess.call([sys.executable, '-m', 'pip', 'install', 'conan'])
- from conans import client
-
try:
from skbuild import setup
except ImportError:
@@ -46,8 +40,6 @@ common_requirements = [
setup_requirements = common_requirements + [
'scikit-build',
- 'cmake!=3.17,!=3.17.0',
- 'conan>=1.22.2'
]
requirements = common_requirements + ['qiskit-terra>=0.12.0']

View File

@@ -2,6 +2,7 @@
, pythonOlder
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
# , cplex
, cvxpy
, dlx
@@ -16,6 +17,7 @@
, qiskit-terra
, quandl
, scikitlearn
, yfinance
# Check Inputs
, ddt
, pytestCheckHook
@@ -24,7 +26,7 @@
buildPythonPackage rec {
pname = "qiskit-aqua";
version = "0.7.3";
version = "0.7.5";
disabled = pythonOlder "3.5";
@@ -33,9 +35,18 @@ buildPythonPackage rec {
owner = "Qiskit";
repo = "qiskit-aqua";
rev = version;
sha256 = "04zcnrc0vi6dfjahp1019h2ngdgi7l7jvfs9aw0y306nd9g6qgjc";
sha256 = "19sdv7lnc4b1c86rd1dv7pjpi8cmrpzbv7nav0fb899ki8ldqdwq";
};
# TODO: remove in next release
patches = [
(fetchpatch {
name = "qiskit-aqua-fix-test-issue-1214.patch";
url = "https://github.com/Qiskit/qiskit-aqua/commit/284a4323192ac85787b22cbe5f344996fae16f7d.patch";
sha256 = "0zl8hqa2fq9ng793x4dhh0ny67nnbjcd8l1cdsaaab4ca1y0xcfr";
})
];
# Optional packages: pyscf (see below NOTE) & pytorch. Can install via pip/nix if needed.
propagatedBuildInputs = [
# cplex
@@ -51,6 +62,7 @@ buildPythonPackage rec {
qiskit-ignis
quandl
scikitlearn
yfinance
];
# *** NOTE ***
@@ -105,8 +117,9 @@ buildPythonPackage rec {
# Disabled due to missing pyscf
"test_validate" # test/chemistry/test_inputparser.py
"test_binary" # in SklearnSVM, seems to have trouble with eigenvectors converging
"test_pauli_expect_single" # fails for unknown reason, 3e-3 out of tolerance
# Online tests
"test_exchangedata"
"test_yahoo"
# Disabling slow tests > 10 seconds
"TestVQE"
@@ -119,7 +132,6 @@ buildPythonPackage rec {
"TestQGAN"
"test_evaluate_qasm_mode"
"test_measurement_error_mitigation_auto_refresh"
"test_exchangedata"
"test_wikipedia"
"test_shor_factoring_1__15___qasm_simulator____3__5__"
"test_readme_sample"
@@ -138,11 +150,13 @@ buildPythonPackage rec {
"test_oh"
"test_confidence_intervals_00001"
"test_eoh"
"test_qasm_5"
];
meta = with lib; {
description = "An extensible library of quantum computing algorithms";
homepage = "https://github.com/QISKit/qiskit-aqua";
changelog = "https://qiskit.org/documentation/release_notes.html";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};

View File

@@ -26,7 +26,7 @@
buildPythonPackage rec {
pname = "qiskit-ibmq-provider";
version = "0.7.2";
version = "0.8.0";
disabled = pythonOlder "3.6";
@@ -34,7 +34,7 @@ buildPythonPackage rec {
owner = "Qiskit";
repo = pname;
rev = version;
sha256 = "11h1ca4v11pajzn1cxqhim1hfziqzj27xzakwln13g8zmiqx3csp";
sha256 = "0rrpwr4a82j69j5ibl2g0nw8wbpg201cfz6f234k2v6pj500x9nl";
};
propagatedBuildInputs = [
@@ -85,6 +85,7 @@ buildPythonPackage rec {
meta = with lib; {
description = "Qiskit provider for accessing the quantum devices and simulators at IBMQ";
homepage = "https://github.com/Qiskit/qiskit-ibmq-provider";
changelog = "https://qiskit.org/documentation/release_notes.html";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};

View File

@@ -9,14 +9,15 @@
, scikitlearn
, scipy
# Check Inputs
, ddt
, pytestCheckHook
, ddt
, pyfakefs
, qiskit-aer
}:
buildPythonPackage rec {
pname = "qiskit-ignis";
version = "0.3.3";
version = "0.4.0";
disabled = pythonOlder "3.6";
@@ -25,7 +26,7 @@ buildPythonPackage rec {
owner = "Qiskit";
repo = "qiskit-ignis";
rev = version;
sha256 = "0sy9qpw0jqirsk9y61j5kr18jrw1wa812n7y98fjj6w668rrv560";
sha256 = "07mxhaknkp121xm6mgrpcrbj9qw6j924ra3k0s6vr8qgvfcxvh0y";
};
propagatedBuildInputs = [
@@ -41,18 +42,21 @@ buildPythonPackage rec {
dontUseSetuptoolsCheck = true;
preCheck = "export HOME=$TMPDIR";
checkInputs = [
ddt
pytestCheckHook
ddt
pyfakefs
qiskit-aer
];
# Test is in test/verification/test_entanglemet.py. test fails due to out-of-date calls & bad logic with this file since qiskit-ignis#328
# see qiskit-ignis#386 for all issues. Should be able to re-enable in future.
disabledTests = [ "TestEntanglement" ];
disabledTests = [
"test_tensored_meas_cal_on_circuit" # Flaky test, occasionally returns result outside bounds
"test_qv_fitter" # execution hangs, ran for several minutes
];
meta = with lib; {
description = "Qiskit tools for quantum hardware verification, noise characterization, and error correction";
homepage = "https://qiskit.org/ignis";
downloadPage = "https://github.com/QISKit/qiskit-ignis/releases";
changelog = "https://qiskit.org/documentation/release_notes.html";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};

View File

@@ -8,12 +8,11 @@
, fastjsonschema
, jsonschema
, numpy
, marshmallow
, marshmallow-polyfield
, networkx
, ply
, psutil
, python-constraint
, python-dateutil
, retworkx
, scipy
, sympy
@@ -36,7 +35,7 @@
buildPythonPackage rec {
pname = "qiskit-terra";
version = "0.14.2";
version = "0.15.1";
disabled = pythonOlder "3.5";
@@ -44,7 +43,7 @@ buildPythonPackage rec {
owner = "Qiskit";
repo = pname;
rev = version;
sha256 = "0p5wapjvy81pnks100xbb23kbs2wyys9ykyc8z4968wl487lq4g5";
sha256 = "1p7y36gj3675dmp05nwi0m9nc7h0bwyimir3ncf9wbkx3crrh99c";
};
nativeBuildInputs = [ cython ];
@@ -54,13 +53,12 @@ buildPythonPackage rec {
fastjsonschema
jsonschema
numpy
marshmallow
marshmallow-polyfield
matplotlib
networkx
ply
psutil
python-constraint
python-dateutil
retworkx
scipy
sympy
@@ -74,10 +72,6 @@ buildPythonPackage rec {
seaborn
];
postPatch = ''
# Fix relative imports in tests
touch test/python/dagcircuit/__init__.py
'';
# *** Tests ***
checkInputs = [
@@ -94,9 +88,6 @@ buildPythonPackage rec {
"qiskit.transpiler.passes.routing.cython.stochastic_swap.swap_trial"
];
disabledTests = [
"test_random_clifford_valid" # random test, fails at least once when testing locally.
];
pytestFlagsArray = [
"--ignore=test/randomized/test_transpiler_equivalence.py" # collection requires qiskit-aer, which would cause circular dependency
];
@@ -106,9 +97,9 @@ buildPythonPackage rec {
preCheck = ''
export PACKAGEDIR=$out/${python.sitePackages}
echo "Moving Qiskit test files to package directory"
cp -r $TMP/source/test $PACKAGEDIR
cp -r $TMP/source/examples $PACKAGEDIR
cp -r $TMP/source/qiskit/schemas/examples $PACKAGEDIR/qiskit/schemas/
cp -r $TMP/$sourceRoot/test $PACKAGEDIR
cp -r $TMP/$sourceRoot/examples $PACKAGEDIR
cp -r $TMP/$sourceRoot/qiskit/schemas/examples $PACKAGEDIR/qiskit/schemas/
# run pytest from Nix's $out path
pushd $PACKAGEDIR
@@ -127,6 +118,7 @@ buildPythonPackage rec {
'';
homepage = "https://qiskit.org/terra";
downloadPage = "https://github.com/QISKit/qiskit-terra/releases";
changelog = "https://qiskit.org/documentation/release_notes.html";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};

View File

@@ -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.19.6";
version = "0.20.0";
disabled = pythonOlder "3.5";
@@ -23,7 +23,7 @@ buildPythonPackage rec {
owner = "Qiskit";
repo = "qiskit";
rev = version;
sha256 = "0liby6ffgrla6wr4k742qkg8m80im372p6hmr4gkz47nmc76zy1i";
sha256 = "1r23pjnql49gczf4k4m6ir5rr95gqdxjrks60p8a93d243mxx3c9";
};
propagatedBuildInputs = [
@@ -36,14 +36,21 @@ buildPythonPackage rec {
checkInputs = [ pytestCheckHook ];
dontUseSetuptoolsCheck = true;
# following doesn't work b/c they are distributed across different nix sitePackages dirs. Tested with pytest though.
pythonImportsCheck = [ "qiskit" "qiskit.circuit" "qiskit.ignis" "qiskit.providers.aer" "qiskit.aqua" ];
meta = {
pythonImportsCheck = [
"qiskit"
"qiskit.aqua"
"qiskit.circuit"
"qiskit.ignis"
"qiskit.providers.aer"
];
meta = with lib; {
description = "Software for developing quantum computing programs";
homepage = "https://qiskit.org";
downloadPage = "https://github.com/QISKit/qiskit/releases";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ drewrisinger pandaman ];
changelog = "https://qiskit.org/documentation/release_notes.html";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger pandaman ];
};
}

View File

@@ -1,53 +1,60 @@
{ lib
, buildPythonPackage
, pythonOlder
, pythonAtLeast
, rustPlatform
, python
, fetchpatch
, fetchFromGitHub
, fetchPypi
, pipInstallHook
, maturin
, pip
# Check inputs
, pytestCheckHook
, numpy
}:
let
rx-version = "0.3.4";
wheel-hashes = {
"3.7" = { python = "cp37"; sha256 = "1hfrdj8svkfdraa299gcj18a601l4zn646fkgq7m56brpagssf9l"; };
"3.8" = { python = "cp38"; sha256 = "0jm10ywaqr0b456pcp01pb7035nawlndfi998jv8p1a2f5xwjgiq"; };
};
lookup = set: key: default: if (builtins.hasAttr key set) then (builtins.getAttr key set) else default;
wheel-args = lookup
wheel-hashes
python.pythonVersion
(throw "retworkx python version & hash not included. Override attribute `wheel-args` with version & hash at https://pypi.org/project/retworkx");
rustPlatform.buildRustPackage rec {
pname = "retworkx";
version = "0.4.0";
github-source = fetchFromGitHub {
src = fetchFromGitHub {
owner = "Qiskit";
repo = "retworkx";
rev = rx-version;
sha256 = "0cd3x64y49q9a3jrkiknlfkiccxkxgl624x5pqk7gm34s1lnzl8h";
};
in
buildPythonPackage rec {
pname = "retworkx";
version = rx-version;
format = "wheel";
disabled = pythonOlder "3.5" || pythonAtLeast "3.9"; # compiled versions only included for 3.5 <= py <= 3.8
src = fetchPypi {
inherit pname version format;
inherit (wheel-args) python sha256;
abi = if pythonOlder "3.8" then "${wheel-args.python}m" else wheel-args.python;
platform = "manylinux2010_x86_64"; # i686, aarch64, and ppc64 also available, restricting to x86 for simplicity
rev = version;
sha256 = "1xqp6d39apkjvd0ad9vw81cp2iqzhpagfa4p171xqm3bwfn2imdc";
};
pythonImportsCheck = [ "retworkx" ];
cargoSha256 = "0bma0l14jv5qhcsxck7vw3ak1w3c8v84cq4hii86i4iqk523zns5";
cargoPatches = [
( fetchpatch {
name = "retworkx-cargo-lock.patch";
url = "https://github.com/Qiskit/retworkx/commit/a02fd33d357a92dbe9530696a6d85aa59fe8a5b9.patch";
sha256 = "0gvxr1nqp9ll4skfks4p4d964pshal25kb1nbfzhpyipnzddizr5";
} )
];
checkInputs = [ pytestCheckHook ];
propagatedBuildInputs = [ python ];
nativeBuildInputs = [ pipInstallHook maturin pip ];
# Need to check AFTER python wheel is installed (b/c using Rust Build, not buildPythonPackage)
doCheck = false;
doInstallCheck = true;
buildPhase = ''
runHook preBuild
maturin build --release --manylinux off --strip --interpreter ${python.interpreter}
runHook postBuild
'';
installPhase = ''
install -Dm644 -t dist target/wheels/*.whl
pipInstallPhase
'';
installCheckInputs = [ pytestCheckHook numpy ];
preCheck = ''
pushd $(mktemp -d)
cp -r ${github-source}/$sourceRoot/tests .
export TESTDIR=$(mktemp -d)
cp -r $TMP/$sourceRoot/tests $TESTDIR
pushd $TESTDIR
'';
postCheck = "popd";
@@ -55,8 +62,8 @@ buildPythonPackage rec {
description = "A python graph library implemented in Rust.";
homepage = "https://retworkx.readthedocs.io/en/latest/index.html";
downloadPage = "https://github.com/Qiskit/retworkx/releases";
changelog = "https://github.com/Qiskit/retworkx/releases/tag/${version}";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
platforms = platforms.x86_64;
};
}

View File

@@ -0,0 +1,36 @@
{ lib
, buildPythonPackage
, fetchPypi
, multitasking
, numpy
, pandas
, requests
}:
buildPythonPackage rec {
pname = "yfinance";
version = "0.1.54";
# GitHub source releases aren't tagged
src = fetchPypi {
inherit pname version;
sha256 = "cee223cbd31e14955869f7978bcf83776d644345c7dea31ba5d41c309bfb0d3d";
};
propagatedBuildInputs = [
multitasking
numpy
pandas
requests
];
doCheck = false; # Tests require internet access
pythonImportsCheck = [ "yfinance" ];
meta = with lib; {
description = "Yahoo! Finance market data downloader (+faster Pandas Datareader)";
homepage = "https://aroussi.com/post/python-yahoo-finance";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};
}