The error when using lightning.gpu

Hi! Here’s my question.
After installing cuQuantum and Lightning[gpu] plugin,
I tried to use the code below:

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

But I got the error message below:

/bin/python3 /home/zoe_jack/test_penny/hymenoptera_data/pennytest.py
Traceback (most recent call last):
  File "/home/zoe_jack/test_penny/hymenoptera_data/pennytest.py", line 39, in <module>
    dev = qml.device("lightning.gpu", wires=n_qubits)
  File "/home/zoe_jack/.local/lib/python3.10/site-packages/pennylane/__init__.py", line 336, in device
    plugin_device_class = plugin_devices[name].load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2465, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2471, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/zoe_jack/.local/lib/python3.10/site-packages/pennylane_lightning/lightning_gpu/__init__.py", line 17, in <module>
    from .lightning_gpu import LightningGPU
  File "/home/zoe_jack/.local/lib/python3.10/site-packages/pennylane_lightning/lightning_gpu/lightning_gpu.py", line 23, in <module>
    from pennylane_lightning.core.lightning_base import (
  File "/home/zoe_jack/.local/lib/python3.10/site-packages/pennylane_lightning/core/lightning_base.py", line 30, in <module>
    from pennylane.devices import DefaultQubitLegacy
ImportError: cannot import name 'DefaultQubitLegacy' from 'pennylane.devices' (/home/zoe_jack/.local/lib/python3.10/site-packages/pennylane/devices/__init__.py)

What’s wrong with my code or installation? Plz help me to solve it!
(PennyLane version : 0.32.0)

Hi Zoe123Sleep,
Could please re-try the installation in a fresh environment, and with PennyLane 0.33?
Let us know if this works!

Hi! Let me tell you my scenario.I’m doing transfer learning recently, which completely references to the tutorial from pennylane.

And I encountered with some issue when using version 0.33.0(It said that tensors appear in cuda:0 and cpu), so I changed my version to 0.32.0!

Now I follow your recommendation to install PennyLane 0.33.0 with using lightning.gpu, and it can work! But the training becomes slower than before… Did I do something wrong?

Hi! I’m glad it worked!
Could you please provide more context to this issue?
To better assess your situation it would be useful to know what you are comparing and the times observed.