Pip install pennylane-lightling GPU error

While installing the pennylane-lightning-gpu==0.33.0 version on the linux system, the below error occurs:

.

I tried to change the version of pennylane-lightning-gpu but the same error still happens.
Here is my procedure to install pennylane-gpu vesion.
step 1: pip install cuquantum-python-cu11 (installed successfully)
step 2: pip install PennyLane-Lightning-GPU==0.33.0 (failed.)

Below is the info of nvidia smi.
±----------------------------------------------------------------------------+
| NVIDIA-SMI 525.85.12 Driver Version: 525.85.12 CUDA Version: 12.0 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA A800 80G… Off | 00000000:CA:00.0 Off | Off |
| N/A 28C P0 62W / 300W | 1643MiB / 81920MiB | 0% Default |
| | | Disabled |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
±----------------------------------------------------------------------------+

What should I do to solve this problem?

Thanks for your help.

Hi @Feng_Xiong, welcome to the Forum!

Our latest version available of PennyLane and pennylane-lightning-gpu is version 0.36. Are you able to update to this version? You would also need to update custatevec to use CUDA 12.

  • Firstly, you can try upgrading the lightning.gpu installed package as python -m pip install pennylane pennylane-lightning pennylane-lightning-gpu --upgrade to ensure the version is the most recent (v0.36.0 as of writing). Once this is installed and up to date, you can try pip install custatevec-cu12 to bring in the CUDA 12 variant of the NVIDIA cuQuantum custatevec library.
  • lightning.gpu requires a CUDA compute capability of SM7.0 or newer (Volta era and newer) to work. This is a hard requirement from the NVIDIA cuQuantum SDK (specifically the custatevec library), as the library expects data-center/HPC grade hardware to run. I cannot tell which GPUs you have installed, but it may be possible they are not supported by the library. You can inspect the compute capabilities for a variety of NVIDIA devices here

I hope this can help you get running in no time!

Hello Catalina,

I’ve confirmed that “custatevec-cu12” is already installed, but I’m still encountering issues when attempting to install “pennylane-lightning-gpu” using the command “python -m pip install pennylane pennylane-lightning pennylane-lightning-gpu --upgrade.” The error persists as shown in the screenshot below:

The Nvidia device I’m using is an A800. Based on my experience with successfully running VisionTransformer code using the PyTorch library, I suspect that the installation issue lies with “pennylane-lightning-gpu.”

Hi @Feng_Xiong, this looks like version conflicts somewhere.

Would you be able to create a new virtual environment following the instructions in Option 2 in the document below? Once you’ve created a new virtual environment please install PennyLane, Lightning-GPU, and custatevec as I mentioned in my previous post. Please let me know if this fixes your issue! If not you may need to use venv instead of miniconda.

PennyLane installation instructions - May 2024.pdf (82.9 KB)

Hi @Feng_Xiong

Looking at your original image, the problem appears to be the local PyPI mirror provided by your university (pip is being redirected to install from https://pypi.tuna.tsinghua.edu.cn/packages/92/f9/a5b378881af35696ad046f378ce75fd4449d01153a0b58a6d81b2c69213a/ rather than from PennyLane-Lightning-GPU · PyPI) — it is missing the precompiled LightningGPU wheels. We recommend directly using the wheels provided from PennyLane-Lightning-GPU · PyPI targeting Linux and the version of Python you need, or requesting your university to update the package to include the precompiled wheels.

Hope this helps.

Hi, I am encountering the same issue. Despite using the command pip install pennylane-lightning-gpu -i https://pypi.org/simple --no-cache-dir, I continue to receive an error. Furthermore, even after downloading and attempting to install the pennylane_lightning_gpu-0.37.0.tar.gz file, the issue persists. Any assistance or guidance on this matter would be greatly appreciated.

Hi @chirtee ,

Welcome to the Forum!

What device are you running on? What’s your output for qml.about()? And what’s your full error traceback?

In general the recommendation is to first create a new virtual environment and then run:

pip install pennylane custatevec-cu12 pennylane-lightning-gpu

If you’re having trouble with a Miniconda virtual environment you can use venv instead. You can find instructions on how to install PennyLane with venv below.

PennyLane installation instructions 2024.pdf (82.1 KB)

Remember that lightning.gpu only works on NVIDIA GPUs with at least SM 7.0 (Volta and Ampere architectures).