Hello,
I want to upgrade my code and use the 0.38 version of the Qiskit plugin. I ran the code from The Remote device — PennyLane-Qiskit 0.38.0 documentation
Code:
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime.fake_provider import FakeManilaV2
backend = FakeManilaV2()
dev = qml.device(
"qiskit.remote",
wires=5,
backend=backend,
resilience_level=1,
optimization_level=1,
seed_transpiler=42
)
@qml.qnode(dev)
def circuit(x, y, z):
qml.RZ(z, wires=[0])
qml.RY(y, wires=[0])
qml.RX(x, wires=[0])
qml.CNOT(wires=[0, 1])
return qml.expval(qml.PauliZ(wires=1))
circuit(0.2, 0.1, 0.3)
And I got the error:
File ~/pennylane-qiskit/lib/python3.12/site-packages/pennylane_qiskit/qiskit_device.py:646, in QiskitDevice._execute_estimator(self, circuit, session)
643 # the Estimator primitive takes care of diagonalization and measurements itself,
644 # so diagonalizing gates and measurements are not included in the circuit
645 qcirc = [circuit_to_qiskit(circuit, self.num_wires, diagonalize=False, measure=False)]
--> 646 estimator = Estimator(session=session)
648 pauli_observables = [mp_to_pauli(mp, self.num_wires) for mp in circuit.measurements]
649 compiled_circuits = self.compile_circuits(qcirc)
TypeError: EstimatorV2.__init__() got an unexpected keyword argument 'session'
It’s from the documentation so I don’t know what to do…
About qml.about():
Name: PennyLane
Version: 0.38.0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author:
Author-email:
License: Apache License 2.0
Location: /Users/christophe_pere/pennylane-qiskit/lib/python3.12/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, toml, typing-extensions
Required-by: PennyLane-qiskit, PennyLane_Lightning
Platform info: macOS-15.0-arm64-arm-64bit
Python version: 3.12.6
Numpy version: 1.26.4
Scipy version: 1.14.1
Installed devices:
- qiskit.aer (PennyLane-qiskit-0.38.0)
- qiskit.basicaer (PennyLane-qiskit-0.38.0)
- qiskit.basicsim (PennyLane-qiskit-0.38.0)
- qiskit.remote (PennyLane-qiskit-0.38.0)
- lightning.qubit (PennyLane_Lightning-0.38.0)
- default.clifford (PennyLane-0.38.0)
- default.gaussian (PennyLane-0.38.0)
- default.mixed (PennyLane-0.38.0)
- default.qubit (PennyLane-0.38.0)
- default.qubit.autograd (PennyLane-0.38.0)
- default.qubit.jax (PennyLane-0.38.0)
- default.qubit.legacy (PennyLane-0.38.0)
- default.qubit.tf (PennyLane-0.38.0)
- default.qubit.torch (PennyLane-0.38.0)
- default.qutrit (PennyLane-0.38.0)
- default.qutrit.mixed (PennyLane-0.38.0)
- default.tensor (PennyLane-0.38.0)
- null.qubit (PennyLane-0.38.0)