Pennylane-Lightning GPU

Hi @George_LA and @mass_of_15

To better help with this issue, it would be a big help to have an end-to-end example that is directly runnable as a python file. While I understand it can be a challenge when these issues pop up, if we can do python your_file.py on a given script that throws the error, we can more easily examine the source of the issue. Since the earlier example with lightning.gpu doesn’t attempt to run any code, and just set’s up the problem I am unable to reproduce it locally.

If the earlier example is what is causing the issue for you, after defining the device, can I suggest you ensure you have no additional directories at the path you are running the code — in this instance, running PennyLane code without directories named pennylane pennylane-lightning or pennnylane-lightning-gpu, as they can interfere with the Python package resolution. If you have this structure, you can try this with python -I my_script.py which tells the Python environment to ignore all current and user site-packages (see here for more info).

If that fails, can you output the following so that we can see the binaries are correctly installed:

ls $(python -c "import os; import pennylane_lightning as pll; print(os.path.dirname(pll.__file__))")
ls $(python -c "import os; import pennylane_lightning_gpu as plg; print(os.path.dirname(plg.__file__))")
echo $PYTHONPATH

Also, please ensure that cuquantum is installed with the corresponding CUDA 11.x version. You can force this via python -m pip install custatevec-cu11.

Lastly, to ensure no issues occur due to cross-contamination of other environments, it is always best to start all experiments from a fresh Python env, as different versions can cause issues.

Feel free to let us know if any of the above helps.

1 Like