Hello! so I’m using google colab and I have tensorflow pennylane qiskit qiskit_ibm_runtime pennylane_qiskit. I restarted runtime too but the error is still there.
# Quantum Circuit Setup
n_qubits = 2
n_layers = 1
#Available Backends
available_backends = service.backends(filters=lambda x: (x.configuration().n_qubits >= n_qubits) and (x.status().operational))
print("Available backends:")
for backend in available_backends:
print(f"- {backend.name}")
# Choose a backend from the available ones
backend_name = 'ibm_brisbane'
#Define the Quantum Device
dev = qml.device(
'qiskit',
wires=n_qubits,
backend=backend_name,
provider=service,
shots=1024
)
# Adjust the QNode
@qml.qnode(dev, interface='tf', diff_method='parameter-shift')
def quantum_circuit(inputs, weights):
qml.templates.AngleEmbedding(inputs, wires=range(n_qubits), rotation='Y')
qml.templates.StronglyEntanglingLayers(weights, wires=range(n_qubits))
return [qml.expval(qml.PauliZ(wires=i)) for i in range(n_qubits)]
weight_shapes = {"weights": (n_layers, n_qubits, 3)}
quantum_layer = qml.qnn.KerasLayer(quantum_circuit, weight_shapes, output_dim=n_qubits)
If you want help with diagnosing an error, please put the full error message below:
DeviceError Traceback (most recent call last)
<ipython-input-9-0950305dbfbc> in <cell line: 71>()
69
70 # **Define the Quantum Device**
---> 71 dev = qml.device(
72 'qiskit',
73 wires=n_qubits,
/usr/local/lib/python3.10/dist-packages/pennylane/devices/device_constructor.py in device(name, *args, **kwargs)
282 return dev
283
--> 284 raise qml.DeviceError(
285 f"Device {name} does not exist. Make sure the required plugin is installed."
286 )
DeviceError: Device qiskit does not exist. Make sure the required plugin is installed.
And, finally, make sure to include the versions of your packages. Specifically, show us the output of qml.about()
.
Name: PennyLane
Version: 0.39.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: GitHub - PennyLaneAI/pennylane: 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.
Author:
Author-email:
License: Apache License 2.0
Location: /usr/local/lib/python3.10/dist-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: Linux-6.1.85±x86_64-with-glibc2.35
Python version: 3.10.12
Numpy version: 1.26.4
Scipy version: 1.13.1
Installed devices:
- qiskit.aer (PennyLane-qiskit-0.40.0.dev0)
- qiskit.basicaer (PennyLane-qiskit-0.40.0.dev0)
- qiskit.basicsim (PennyLane-qiskit-0.40.0.dev0)
- qiskit.remote (PennyLane-qiskit-0.40.0.dev0)
- default.clifford (PennyLane-0.39.0)
- default.gaussian (PennyLane-0.39.0)
- default.mixed (PennyLane-0.39.0)
- default.qubit (PennyLane-0.39.0)
- default.qutrit (PennyLane-0.39.0)
- default.qutrit.mixed (PennyLane-0.39.0)
- default.tensor (PennyLane-0.39.0)
- null.qubit (PennyLane-0.39.0)
- reference.qubit (PennyLane-0.39.0)
- lightning.qubit (PennyLane_Lightning-0.39.0)