mitiq
mitiq copied to clipboard
Any qiskit circuit that requires conversion to qasm breaks as of qiskit 1.0.1
Issue Description
Example: Take the cdr case. We want to generate clifford training data with the input as qiskit quantum circuit. This fails with the error as
'QuantumCircuit' object has no attribute 'qasm'
How to Reproduce
Minimum steps
from qiskit import QuantumCircuit
from mitiq.cdr import generate_training_circuits
qc = QuantumCircuit(3)
qc.h(0)
qc.cx(0,1)
qc.cx(1,2)
cd = generate_training_circuits(qc, 10, 0.1)
This generates following error
AttributeError: 'QuantumCircuit' object has no attribute 'qasm'
Root Cause
QuantumCircuit object from qiskit 1.0.1 no longer has qasm as an attribute
Possible solutions and workarounds
Fix - Replace circuit.qasm() in from_qiskit function with qiskit.qasm2.dumps(circuit) This fix also works with qiskit 0.45
Environment Context
Use the about()
function to summarize information on operating system, python version and dependencies.
from mitiq import about
about()
Additional Python Environment Details (pip freeze
or conda list
):
Mitiq version 0.34 Qiskit 1.0.1
Copy and paste the output of `pip freeze` or `conda list` here.
Hello @hrushikesh890, thank you for your interest in Mitiq! If this is a bug report, please provide screenshots and/or minimum viable code to reproduce your issue, so we can do our best to help get it fixed. If you have any questions in the meantime, you can also ask us on the Unitary Fund Discord.
@hrushikesh890 Thank you for creating this issue. Yes, we are aware of the errors related to qiskit 1.0.1
https://github.com/unitaryfund/mitiq/pull/2207. Our next release should hopefully fix these.
Until then, you will have to switch to an earlier version as specified in the dependencies of the project. https://github.com/unitaryfund/mitiq/blob/c5afbd4df6850cacc331a1aa1a477265d4bb584a/dev_requirements.txt#L1-L4