Closed andreamari closed 2 years ago
Hi @andreamari, thank you for pointing this out and for suggesting the fix!
Thanks @andreamari, I'll open a PR for the new version of Qiskit!
Apologies everyone - this shouldn't have been removed without a deprecation warning, and I'll add it back (with a deprecation warning) in Terra 0.19.1 later this week. The loose measure
function here was never meant to be public; it was just a hold-over from how we used to build up the QuantumCircuit
object with monkey-patching, and in a tidy-up for Terra 0.19 it got removed. The solution Andrea suggested is identical to the current code, and what the deprecation warning will suggest you do in the future. (Literally - the exact measure
function you were importing was bound to QuantumCircuit.measure
.)
See Qiskit/qiskit-terra#7370 for our tracking issue on this.
Terra 0.19.1 and Qiskit 0.33.1 are live on PyPI now, which re-instated these functions with deprecation warnings.
Thank you @jakelishman! :pray:
Describe the bug In the last version (
0.33.0
) of qiskit the functionmeasure
has been removed fromqiskit.circuit.measure
. Inpennylane_qiskit.qiskit_device.py
there is however this line that now can create problems: https://github.com/PennyLaneAI/pennylane-qiskit/blob/0998b85dc730566d3f5c167e6f789ebaef255b93/pennylane_qiskit/qiskit_device.py#L27To Reproduce Note sure how to reproduce, but the problem shows up in a Mitiq PR https://github.com/unitaryfund/mitiq/pull/1040. See this line: https://github.com/unitaryfund/mitiq/runs/4442208499?check_suite_focus=true#step:6:2449
Possible Fix Removing the import: https://github.com/PennyLaneAI/pennylane-qiskit/blob/0998b85dc730566d3f5c167e6f789ebaef255b93/pennylane_qiskit/qiskit_device.py#L27
and replacing https://github.com/PennyLaneAI/pennylane-qiskit/blob/0998b85dc730566d3f5c167e6f789ebaef255b93/pennylane_qiskit/qiskit_device.py#L232 with
self._circuit.measure(qr, cr)
may fix the problem. Not tested.