After creating a conda python 3.9 environment and activating it
I ran the following command:
pip3 install -r tutorial_requirements.txt
from the following page:
The I ran the following code and got the error as shown.
import pennylane as qml
import qiskit
import pennylane as qml
from pennylane import numpy as np
dev = qml.device('qiskit.aer',wires=2, shots=10)
@qml.qnode(dev)
def circuit(w):
qml.Hadamard(wires=0)
qml.RX(w,wires=0)
return qml.expval(qml.PauliZ(0))
w=np.array(0.1,requires_grad=True)
opt = qml.GradientDescentOptimizer(stepsize=0.1)
w, cost = opt.step_and_cost(circuit, w)
print(cost)
Error message:
Traceback (most recent call last):
File "/media/xxx/C-UAS-DB1/QuFI/test_aer.py", line 8, in <module>
dev = qml.device('qiskit.aer',wires=2, shots=10)
File "/home/xxx/anaconda/envs/qufi2/lib/python3.9/site-packages/pennylane/__init__.py", line 338, in device
raise DeviceError("Device does not exist. Make sure the required plugin is installed.")
pennylane._device.DeviceError: Device does not exist. Make sure the required plugin is installed.
>>> qml.about()
Name: PennyLane
Version: 0.30.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: https://github.com/XanaduAI/pennylane
Author:
Author-email:
License: Apache License 2.0
Location: /home/xxx/anaconda/envs/qufi2/lib/python3.9/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml
Required-by: PennyLane-Lightning
Platform info: Linux-5.4.0-150-generic-x86_64-with-glibc2.27
Python version: 3.9.19
Numpy version: 1.23.5
Scipy version: 1.10.1
Installed devices:
- default.gaussian (PennyLane-0.30.0)
- default.mixed (PennyLane-0.30.0)
- default.qubit (PennyLane-0.30.0)
- default.qubit.autograd (PennyLane-0.30.0)
- default.qubit.jax (PennyLane-0.30.0)
- default.qubit.tf (PennyLane-0.30.0)
- default.qubit.torch (PennyLane-0.30.0)
- default.qutrit (PennyLane-0.30.0)
- null.qubit (PennyLane-0.30.0)
- lightning.qubit (PennyLane-Lightning-0.30.0)
I also get the same error when I run the run_circuits.py script from the github page. What could be the issue here?