Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update qiskit requirement from ~=0.45.1 to ~=1.0.1 #2207

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# Third-party integration.
qiskit~=0.45.1
qiskit-aer~=0.13.2
qiskit-ibm-provider~=0.8.0
qiskit~=1.0.1
qiskit-aer~=0.13.3
qiskit-ibm-provider~=0.10.0
qiskit-ibm-runtime~=0.20.0
pyquil~=3.5.4
pennylane-qiskit~=0.34.0
pennylane~=0.34.0
amazon-braket-sdk~=1.69.0
amazon-braket-sdk~=1.72.0
qibo~=0.2.4

# Unit tests, coverage, and formatting/style.
pytest==8.0.0
pytest~=8.0.2
pytest-xdist[psutil]==3.0.2
pytest-cov==4.0.0
flake8==7.0.0
black==22.10
mypy==1.0.0
isort==5.13.2
types-tabulate
# https://github.com/virtuald/pyhcl/issues/39#issuecomment-370595465
pyhcl~=0.4.5
ply~=3.11

# Documentation and examples.
Sphinx==5.2.3
sphinxcontrib-bibtex==2.5.0
sphinx-copybutton==0.5.0
sphinx-autodoc-typehints==1.19.4
myst-nb==1.0.0
myst-nb==0.17.2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is reducing the dependency by 1 version only.

https://github.com/executablebooks/MyST-NB/releases

pydata-sphinx-theme==0.11.0
jupytext==1.14.1
sphinx-gallery==0.10.1
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/calibration-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ from mitiq import (
MeasurementResult,
)

from qiskit.providers.fake_provider import FakeJakarta # Fake (simulated) QPU
from qiskit_ibm_runtime.fake_provider import FakeJakarta # Fake (simulated) QPU
```

### Define the circuit to study
Expand Down
4 changes: 2 additions & 2 deletions docs/source/examples/ddd_on_ibmq_ghz.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ kernelspec:

In this notebook DDD is applied to improve the success rate of the computation on a real hardware backend.
A similar approach can be taken on a simulated backend, by setting the ``USE_REAL_HARDWARE`` option to ``False``
and specifying a simulated backend from `qiskit.providers.fake_provider`, which includes a noise model that approximates the noise of the
and specifying a simulated backend from `qiskit_ibm_runtime.fake_provider`, which includes a noise model that approximates the noise of the
real device.

In DDD, sequences of gates are applied to slack windows, i.e. single-qubit idle windows, in a quantum circuit.
Expand Down Expand Up @@ -148,7 +148,7 @@ if USE_REAL_HARDWARE:
provider = IBMProvider()
backend = provider.get_backend("ibmq_lima")
else:
from qiskit.providers.fake_provider import FakeLima as FakeLima
from qiskit_ibm_runtime.fake_provider import FakeLima as FakeLima
backend = FakeLima()


Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/ggi_summer_school_solved.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ from qiskit import QuantumCircuit
from qiskit.providers.aer import AerSimulator
from qiskit.tools.visualization import plot_histogram
from qiskit import transpile
from qiskit.providers.fake_provider import FakeJakarta # Fake (simulated) QPUs
from qiskit_ibm_runtime.fake_provider import FakeJakarta # Fake (simulated) QPUs

# Number of measurements
shots = 10 ** 5
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/ggi_summer_school_unsolved.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ from qiskit import QuantumCircuit
from qiskit_aer import AerSimulator
from qiskit.tools.visualization import plot_histogram
from qiskit import transpile
from qiskit.providers.fake_provider import FakeJakarta # Fake (simulated) QPUs
from qiskit_ibm_runtime.fake_provider import FakeJakarta # Fake (simulated) QPUs

# Number of measurements
shots = 10 ** 5
Expand Down
22 changes: 11 additions & 11 deletions mitiq/ddd/tests/test_insertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@
circuit_qiskit_validated.x(i)
circuit_qiskit_validated.x(3)
if i != 3 and i != 0:
circuit_qiskit_validated.i(i)
circuit_qiskit_validated.id(i)
circuit_qiskit_validated.x(i)
circuit_qiskit_validated.i(i)
circuit_qiskit_validated.id(i)
circuit_qiskit_validated.x(i)
circuit_qiskit_validated.i(i)
circuit_qiskit_validated.id(i)
elif i == 0:
circuit_qiskit_validated.i(i)
circuit_qiskit_validated.id(i)
circuit_qiskit_validated.x(i)
circuit_qiskit_validated.x(i)
circuit_qiskit_validated.i(i)
circuit_qiskit_validated.id(i)
circuit_qiskit_validated.cx(0, 3)

# Qiskit validate with measurement
Expand All @@ -86,17 +86,17 @@
circuit_qiskit_two_validated.x(3)
if i != 3 and i != 0:
if i == 1:
circuit_qiskit_two_validated.i(i)
circuit_qiskit_two_validated.i(i)
circuit_qiskit_two_validated.id(i)
circuit_qiskit_two_validated.id(i)
circuit_qiskit_two_validated.x(i)
circuit_qiskit_two_validated.i(i)
circuit_qiskit_two_validated.id(i)
circuit_qiskit_two_validated.x(i)
circuit_qiskit_two_validated.i(i)
circuit_qiskit_two_validated.id(i)
elif i == 0:
circuit_qiskit_two_validated.i(i)
circuit_qiskit_two_validated.id(i)
circuit_qiskit_two_validated.x(i)
circuit_qiskit_two_validated.x(i)
circuit_qiskit_two_validated.i(i)
circuit_qiskit_two_validated.id(i)
circuit_qiskit_two_validated.cx(0, 3)
circuit_qiskit_two_validated.measure(2, 3)

Expand Down
3 changes: 2 additions & 1 deletion mitiq/interface/mitiq_qiskit/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import numpy as np
import qiskit
from cirq.contrib.qasm_import import circuit_from_qasm
from qiskit.qasm2 import dumps

from mitiq.utils import _simplify_circuit_exponents

Expand Down Expand Up @@ -283,7 +284,7 @@ def from_qiskit(circuit: qiskit.QuantumCircuit) -> cirq.Circuit:
Returns:
Mitiq circuit representation equivalent to the input Qiskit circuit.
"""
return from_qasm(circuit.qasm())
return from_qasm(dumps(circuit))


def from_qasm(qasm: QASMType) -> cirq.Circuit:
Expand Down
5 changes: 3 additions & 2 deletions mitiq/interface/mitiq_qiskit/tests/test_conversions_qiskit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import numpy as np
import pytest
import qiskit
from qiskit.qasm2 import dumps

from mitiq.interface import convert_to_mitiq
from mitiq.interface.mitiq_qiskit.conversions import (
Expand Down Expand Up @@ -209,7 +210,7 @@ def test_convert_with_barrier(as_qasm):
qiskit_circuit.barrier()

if as_qasm:
cirq_circuit = from_qasm(qiskit_circuit.qasm())
cirq_circuit = from_qasm(dumps(qiskit_circuit))
else:
cirq_circuit = from_qiskit(qiskit_circuit)

Expand All @@ -229,7 +230,7 @@ def test_convert_with_multiple_barriers(as_qasm):
qiskit_circuit.barrier()

if as_qasm:
cirq_circuit = from_qasm(qiskit_circuit.qasm())
cirq_circuit = from_qasm(dumps(qiskit_circuit))
else:
cirq_circuit = from_qiskit(qiskit_circuit)

Expand Down
2 changes: 1 addition & 1 deletion mitiq/interface/mitiq_qiskit/tests/test_qiskit_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import pytest
from qiskit import QuantumCircuit
from qiskit.providers.fake_provider import FakeLima
from qiskit_ibm_runtime.fake_provider import FakeLima

from mitiq import MeasurementResult, Observable, PauliString
from mitiq.interface.mitiq_qiskit.qiskit_utils import (
Expand Down
8 changes: 4 additions & 4 deletions mitiq/pec/types/tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_init_with_qiskit_circuit():
qreg = qiskit.QuantumRegister(2)
circ = qiskit.QuantumCircuit(qreg)
_ = circ.h(qreg[0])
_ = circ.cnot(*qreg)
_ = circ.cx(*qreg)

cirq_qreg = cirq.LineQubit.range(2)
cirq_circ = cirq.Circuit(cirq.H.on(cirq_qreg[0]), cirq.CNOT.on(*cirq_qreg))
Expand All @@ -100,8 +100,8 @@ def test_init_with_qiskit_circuit():
(
cirq.H,
cirq.H(cirq.LineQubit(0)),
qiskit.extensions.HGate,
qiskit.extensions.CHGate,
qiskit.circuit.library.HGate,
qiskit.circuit.library.CHGate,
pyquil.gates.H,
),
)
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_unknown_channel_matrix():
qreg = qiskit.QuantumRegister(2)
circ = qiskit.QuantumCircuit(qreg)
_ = circ.h(qreg[0])
_ = circ.cnot(*qreg)
_ = circ.cx(*qreg)

cirq_qreg = cirq.LineQubit.range(2)
cirq_circ = cirq.Circuit(cirq.H.on(cirq_qreg[0]), cirq.CNOT.on(*cirq_qreg))
Expand Down
5 changes: 3 additions & 2 deletions mitiq/tests/test_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from braket.circuits import Instruction
from braket.circuits import gates as braket_gates
from pyquil import Program, gates
from qiskit.qasm2 import dumps

from mitiq import SUPPORTED_PROGRAM_TYPES
from mitiq.interface import (
Expand All @@ -43,8 +44,8 @@
qiskit_qreg = qiskit.QuantumRegister(2)
qiskit_circuit = qiskit.QuantumCircuit(qiskit_qreg)
qiskit_circuit.h(qiskit_qreg[0])
qiskit_circuit.cnot(*qiskit_qreg)
qasm_str = qiskit_circuit.qasm()
qiskit_circuit.cx(*qiskit_qreg)
qasm_str = dumps(qiskit_circuit)


# pyQuil Bell circuit.
Expand Down
2 changes: 1 addition & 1 deletion mitiq/zne/tests/test_zne.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def test_execute_with_zne_transpiled_qiskit_circuit():
"""Tests ZNE when transpiling to a Qiskit device. Note transpiling can
introduce idle (unused) qubits to the circuit.
"""
from qiskit.providers.fake_provider import FakeSantiago
from qiskit_ibm_runtime.fake_provider import FakeSantiago

santiago = FakeSantiago()
backend = qiskit.providers.aer.AerSimulator.from_backend(santiago)
Expand Down
Loading