I'm going through some older tutorials for my employer and everything seems to be working fine except the "iden" attribute. The error is listed below. I assume the name was changed but I don't know what it was changed to, and I don't know how to find out.

AttributeError                            Traceback (most recent call last)
<ipython-input-10-fff169415f56> in <module>
      4 hello_qubit = QuantumCircuit(q)
----> 6 hello_qubit.iden(q[0])
      8 job = execute(hello_qubit, S_simulator)

AttributeError: 'QuantumCircuit' object has no attribute 'iden' '''

Now it is called id:

from qiskit import *

circuit = QuantumCircuit(1)
q_0: ┤ I ├

If you want to implement a delay consider using delay.


Yes, the QuantumCircuit.iden() method was deprecated in the qiskit-terra 0.13.0 release (qiskit 0.18.0) and removed in qiskit-terra 0.16.0 (qiskit 0.23.0): https://qiskit.org/documentation/release_notes.html#release-notes-0-16-0-upgrade-notes

It was replaced with the i() or id(). So you can just replace iden() with either one of those.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.