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

Any qiskit circuit that requires conversion to qasm breaks as of qiskit 1.0.1 #2208

Closed
hrushikesh890 opened this issue Feb 25, 2024 · 2 comments · Fixed by #2269
Closed

Any qiskit circuit that requires conversion to qasm breaks as of qiskit 1.0.1 #2208

hrushikesh890 opened this issue Feb 25, 2024 · 2 comments · Fixed by #2269
Labels
bug Something isn't working

Comments

@hrushikesh890
Copy link

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.
@hrushikesh890 hrushikesh890 added the bug Something isn't working label Feb 25, 2024
Copy link

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.

@purva-thakre
Copy link
Contributor

purva-thakre commented Feb 25, 2024

@hrushikesh890 Thank you for creating this issue. Yes, we are aware of the errors related to qiskit 1.0.1 #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.

# Third-party integration.
qiskit~=0.45.1
qiskit-aer~=0.13.2
qiskit-ibm-provider~=0.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants