diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2b5e32111..0e9f9a69f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: python-version: [3.6, 3.7, 3.8, 3.9] - os: ["macOS-latest", "ubuntu-latest"] + os: ["ubuntu-latest"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} @@ -36,6 +36,37 @@ jobs: run: tox -e py39 if: matrix.python-version == '3.9' + tests-macos: + name: tests-python${{ matrix.python-version }}-${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + os: ["macOS-latest"] + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Pip cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-${{ matrix.python-version }}-pip-tests-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.python-version }}-pip-tests- + ${{ runner.os }}-${{ matrix.python-version }}-pip- + ${{ runner.os }}-${{ matrix.python-version }} + - name: Install Deps + run: python -m pip install -U tox setuptools virtualenv wheel cvxopt + - name: Install and Run Tests + run: tox --sitepackages -e py + if: matrix.python-version != '3.9' + - name: Install and Run Tests + run: tox --sitepackages -e py39 + if: matrix.python-version == '3.9' + tests-no-opt: name: tests-python3.8-no-optional-dependencies runs-on: ${{ matrix.os }} @@ -178,7 +209,7 @@ jobs: run: | set -e cd qiskit-tutorials - rm -rf tutorials/chemistry tutorials/circuits tutorials/circuits_advanced tutorials/finance tutorials/optimization tutorials/simulators + rm -rf tutorials/chemistry tutorials/circuits tutorials/circuits_advanced tutorials/finance tutorials/optimization tutorials/simulators tutorials/machine_learning tutorials/algorithms sphinx-build -b html . _build/html - uses: actions/upload-artifact@v2 with: diff --git a/constraints.txt b/constraints.txt index 2344507f4..786e28ce3 100644 --- a/constraints.txt +++ b/constraints.txt @@ -3,3 +3,4 @@ astroid==2.3.3 pywin32==225 setuptools==49.6.0 pyfakefs==4.1.0 +cvxpy==1.1.7 diff --git a/qiskit/ignis/mitigation/expval/ctmp_mitigator.py b/qiskit/ignis/mitigation/expval/ctmp_mitigator.py index a50075b61..29560ffb0 100644 --- a/qiskit/ignis/mitigation/expval/ctmp_mitigator.py +++ b/qiskit/ignis/mitigation/expval/ctmp_mitigator.py @@ -131,8 +131,8 @@ def expectation_value(self, gamma = self.noise_strength(qubits) bmat = self._sampling_matrix(qubits) values = bmat.data - indices = np.asarray(bmat.indices, dtype=np.int) - indptrs = np.asarray(bmat.indptr, dtype=np.int) + indices = np.asarray(bmat.indices, dtype=int) + indptrs = np.asarray(bmat.indptr, dtype=int) # Set a minimum number of CTMP samples shots = sum(counts.values()) @@ -184,7 +184,7 @@ def generator_matrix(self, qubits: List[int] = None) -> sps.coo_matrix: if qubits not in self._generator_mats: # Construct G from subset generators qubits_set = set(qubits) - g_mat = sps.coo_matrix(2 * (2**len(qubits),), dtype=np.float) + g_mat = sps.coo_matrix(2 * (2**len(qubits),), dtype=float) for gen, rate in zip(self._generators, self._rates): if qubits_set.issuperset(gen[2]): # Keep generator @@ -301,7 +301,7 @@ def _ctmp_inverse( # Apply CTMP sampling r_vals = rng.random(size=alphas.sum()) - y_vals = np.zeros(x_vals.size, dtype=np.int) + y_vals = np.zeros(x_vals.size, dtype=int) _markov_chain_compiled(y_vals, x_vals, r_vals, alphas, csc_data, csc_indices, csc_indptrs) diff --git a/test/verification/test_entanglement.py b/test/verification/test_entanglement.py index 6c1d77c6d..9dafc42b1 100644 --- a/test/verification/test_entanglement.py +++ b/test/verification/test_entanglement.py @@ -22,7 +22,7 @@ import numpy as np -from qiskit.execute import execute +from qiskit import execute from qiskit.providers.basicaer import BasicAer from qiskit.ignis.verification.entanglement import linear diff --git a/tox.ini b/tox.ini index 8c9ada10b..a70bec0fb 100644 --- a/tox.ini +++ b/tox.ini @@ -10,14 +10,14 @@ setenv = VIRTUAL_ENV={envdir} LANGUAGE=en_US LC_ALL=en_US.utf-8 -deps = numpy>=1.13 +deps = numpy>=1.16.3 Cython>=0.27.1 setuptools>=40.1.0 - cvxpy>=1.0.15 passenv = QISKIT_IN_PARALLEL commands = pip install -U -c constraints.txt git+https://github.com/Qiskit/qiskit-terra.git pip install -U -c constraints.txt -r{toxinidir}/requirements-dev.txt + pip install -c constraints.txt cvxpy<1.1.8 pip check stestr run {posargs} # Remove after qiskit-aer 0.8.0 release: @@ -26,6 +26,7 @@ commands = pip install -U -c constraints.txt git+https://github.com/Qiskit/qiskit-terra.git pip install -U -c constraints.txt git+https://github.com/Qiskit/qiskit-aer.git pip install -U -c constraints.txt -r{toxinidir}/requirements-dev.txt + pip install -c constraints.txt cvxpy<1.1.8 pip check stestr run {posargs}