Device default.qubits does not exist. Make sure the required plugin is installed

Please help me solving this device error for default.qubits

import pennylane as qml
from pennylane import numpy as np
from pennylane import qchem
symbols = ["H", "H"]
coordinates = np.array([[-0.673, 0, 0], [0.673, 0, 0]])
hamiltonian, qubits = qchem.molecular_hamiltonian(symbols, coordinates)

num_wires = qubits
dev = qml.device("default.qubits", wires = num_wires)

def exp_energy(state):
    qml.BasisState(np.array(state), wires = range(num_wires))
    return qml.expval(hamiltonian)```

If you want help with diagnosing an error, please put the full error message below:

DeviceError Traceback (most recent call last)
Cell In[7], line 2
1 num_wires = qubits
----> 2 dev = qml.device(“default.qubits”, wires = num_wires)
4 @qml.qnode(dev)
5 def exp_energy(state):
6 qml.BasisState(np.array(state), wires = range(num_wires))

File ~\anaconda3\Lib\site-packages\, in device(name, *args, **kwargs)
334 dev.custom_expand(custom_decomp_expand_fn)
336 return dev
→ 338 raise DeviceError(“Device does not exist. Make sure the required plugin is installed.”)

DeviceError: Device 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()`.

Hello @Lis ! Welcome to the forum!

You have a tiny tiny typo in your code: the name of the device is default_qubit, without “s” in the end. :slight_smile:

yeah! I got it corrected…><

1 Like