Skip to content

QuantumCircuit: some gates have no label attribute #14975

@Bruno-Danti

Description

@Bruno-Danti

Environment

  • Qiskit version: 2.1.2
  • Python version: 3.12.3
  • Operating system: Ubuntu 24.04

What is happening?

Hello :)

While working on a project involving quantum circuits with rx and rz gates, I noticed that some gates, such as rz, don't have a label attribute.

I did fix this small oversight in my local venv (labeling gates is crucial for my particular project) already -my project runs smoothly now- and intend to create a pull request shortly to merge the fix into the public repos, but, following CONTRIBUTING.md's recommendation, I opened this issue to inform the community about my intent.

I am aware of the same issue being already discussed here, but that was for Qiskit 0.46.0 and it doesn't seem to have been fixed now still

How can we reproduce the issue?

Minimal working example:

from qiskit import QuantumCircuit
import numpy as np

qc = QuantumCircuit(4)
qc.rz(np.pi / 3, 1, label = "0")

output:
TypeError: QuantumCircuit.rz() got an unexpected keyword argument 'label'

What should happen?

qc.rz(np.pi / 3, 1, label = "0") should not raise an error, and the qc should afterwards have an RZGate with label "0"

Any suggestions?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions