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

qiskit.qasm3.dumps raise TypeError: only length-1 arrays can be converted to Python scalars #13362

Open
harui2019 opened this issue Oct 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@harui2019
Copy link

Environment

  • Qiskit version:
qiskit                    1.2.4
qiskit-aer                0.15.0
qiskit-aer-gpu            0.14.2
qiskit-algorithms         0.3.0
qiskit-ibm-provider       0.11.0
qiskit-ibm-runtime        0.30.0
qiskit-qasm3-import       0.5.0
  • Python version:
Python 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:50:58) [GCC 12.3.0] on linux
  • Operating system:
Ubuntu 24.04.1 LTS x86_64

What is happening?

A numpy type error raised during the execution of qiskit.qasm3.dumps .

Image
Image

How can we reproduce the issue?

from qiskit import QuantumCircuit
from qiskit.quantum_info import random_unitary
from qiskit.qasm3 import dumps

qc = QuantumCircuit(4)
for i in range(4):
    qc.h(i)
    qc.append(random_unitary(2),[i])
    
print(qc.draw())

dumps(qc)

or

from qiskit import QuantumCircuit
from qiskit.quantum_info import random_unitary
from qiskit.qasm3 import dumps

qc = QuantumCircuit(4)
for i in range(4):
    qc.h(i)
    qc.append(random_unitary(2).to_instruction(),[i])
    
print(qc.draw())

dumps(qc)

What should happen?

I should be able to dump this circuit to QASM3 because qiskit.qasm2.dumps can successfully dump this circuit.

Any suggestions?

This issue appears to be mentioned in #12013 (comment)

@harui2019 harui2019 added the bug Something isn't working label Oct 23, 2024
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

No branches or pull requests

1 participant