Pennylane 0.19 and lightning qbit

Hello.

I have updated pennylane, but it still shows I have the 0.18 version instead of 0.19.
When using dev = qml.device(“lightning.qubit”, wires=10)
why do I get:
DeviceError: Device does not exist. Make sure the required plugin is installed.

Hi @_risto! Are you running pip install pennylane --upgrade? What operating system and Python version are you using?

Hi @josh

Python 3.7.7 and Windows 11.

Hi @_risto, if you use pip install pennylane --upgrade and then pip show pennylane, what do you get?

Hi @CatalinaAlbornoz I got it working now. :slight_smile:

1 Like

I’m glad to hear @_risto!

Can I add a question? :slight_smile:
After using lightning_qubit (dev = qml.device(“lightning.qubit”, wires=10)) in quantum transfer tutorial, I get: WireError: Wire with label 10 not found in <Wires = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]>.

I have read on number of threads there is a bug, but I can’t seem to fix it.

Hi @_risto!

It sounds like somewhere in your code you have written “wires=10” but since wire numbering starts at 0 then the last wire is “wires=9”.

Is this the case?

Hi @CatalinaAlbornoz

Yes, that is correct.

Oh good @_risto I’m glad we found the cause and solution :smiley: .

Yes, I just copy pasted the https://pennylane.ai/blog/2021/09/pennylane-v018-released/
However, no matter the number of wires, I always get this error. Should i delete the wire=10 argument?

Hi @_risto, the problem doesn’t seem to be in the definition of the device but later. Could you copy the full code you’re using?

hi @CatalinaAlbornoz

It is the same as quantum transfer learning tutorial, I just changed the “dev”.

Hi @_risto

I’m a little confused, could you help with your exact steps? Changing the line you mention here from

dev = qml.device("default.qubit", wires=n_qubits)

to

dev = qml.device("lightning.qubit", wires=n_qubits)

works well. The number of qubits, however, is specified earlier in the demonstration here.

Changing that line to

n_qubits = 10                # Number of qubits

executes well too.

Could you confirm that these were the changes you’ve made?

If the error persists, feel free to share the exact code you run into errors with. :slightly_smiling_face:

Hi @antalszava

After clearing caches from my laptop it works. Before I used your suggestion, but still got error.
Is lightning.qubit compatable with gpu usage?
As I run:
dev = qml.device(“lightning.qubit”, wires=n_qubits)
device = torch.device(“cuda:0” if torch.cuda.is_available() else “cpu”)
I don’t see any GPU usage.

I’m glad you could fix it @_risto!

Currently lightning.qubit is not compatable with gpu usage. We are working on it though!

Hi, may I ask how you solved this problem since I get the same error?

Hi @CHU_WENHAO

Unfortunately I can’t remember. It’s been a while since I’ve been working on that and currently can’t even find the notebook.

Hi @CHU_WENHAO and @_risto. We now have a lightning.gpu device.

You can find a usage example here.

This may be what you’re looking for. If it’s not, then please feel free to let us know what is the problem you’re having @CHU_WENHAO!

Hi @CatalinaAlbornoz

When trying to install I get: RuntimeError: Unsupported ‘Windows’ platform
Is lightning.gpu supported by Windows 11?