Available Devices and How to Choose The Correct One

Hello everyone,

I am currently getting started with pennylane, and would like to know more about the different devices. As of now I am working on a platform which does not allow me to install any new package or modify them. I can only use the ones already pre-installed. More precisely, the PennyLane 0.25.1 and PennyLane-Lightning 0.26.1 Python packages are the ones available and the ones I am using.

Here are my questions:

  1. What devices are available when using those package versions specifically? Unfortunately, when I run the following code snippet, I get an error /opt/miniconda3/bin/python: No module named pip, which I cannot solve because I cannot install new packages on the platform I am working on.
import pennylane as qml
print(qml.about())
  1. Although the PennyLane-Lightning package is available, when I try to use the lightning.qubit device, I get the following error: DeviceError: The lightning.qubit plugin requires PennyLane versions >=0.26, however PennyLane version 0.25.1 is installed.. Am I importing pennylane incorrectly or do I need PennyLane >=0.26 to use the lightning.qubit device, even if I have Pennylane-Lightning installed?
import pennylane as qml
dev = qml.device("lightning.qubit", wires=2)
  1. There are many discussion threads here asking which device is best in general or for some specific use. However, I could not find any documentation where all this is described in a single place. How should I decide which device to use for my program/problem? In case I need to be more specific, what device is best suited for QAOA and why?

Thank you very much in advance.

Peter

Hi @pormelrog, welcome to the Forum!

It’s very weird that you have different versions installed because PennyLane already comes packaged with the right version of lightning.qubit without needing to install it separately. My guess is that your system administrator installed it separately with a new version which is incompatible with your current version of PennyLane. That being said, in the plugins section of the PennyLane website you will find the built-in devices that PennyLane comes with. In the card explaining each simulator you will find a recommendation of when you should use one device or the other. We also have this YouTube video which provides an introduction to PennyLane devices, and if you want a more in-depth discussion of how to choose your device you can take a look at this article in the PennyLane blog. For what you need to do your best option is probably the default.qubit device. Normally I would recommend lightning.qubit but since it’s not working for you then default.qubit is a good choice.

Please let me know if this works for you!

1 Like