Error when calling device()

Hi, I am having an error when calling the device:

DeviceError                               Traceback (most recent call last)
<ipython-input-41-5e0abc3e2a88> in <module>()
  4 from pennylane.plugins import default_qubit
  5 import matplotlib.pyplot as plt
----> 6 dev = qml.device('default.qubit', wires=1)
  8 # Set a random seed

/usr/local/lib/python3.6/dist-packages/pennylane/ in device(name, *args, **kwargs)
129     raise DeviceError(
--> 130         "Device does not exist. Make sure the required plugin is installed."
131     )

DeviceError: Device does not exist. Make sure the required plugin is installed.

How can I solve it?
Thanks in advance

Hi @abignu,

:thinking: That’s an unusual error. The default.qubit plugin shouldn’t need any extra installation (comes pre-packaged within pennylane). My guess would be something has gone wrong with your pennylane install. Can you try the following and tell us the output?

import pennylane as qml

Also, can you try uninstalling and reinstalling it and let me know how that works?


PS you shouldn’t need to directly import the plugin (line 4 of your code). This is handled automatically by the qml.device function.

Hi @nathan, thanks for your reply. I was working in Google Colab. I found on another page that restarting the runtime fixes this issue. So I have already fixed it.

Thanks for your time


Glad you got it working :slight_smile: