Error when Installing lightning-kokkos from source

After following the instructions here: pennylane-lightning/README.rst at master · PennyLaneAI/pennylane-lightning · GitHub

I get this error when trying to test my lightning-kokkos installation:

import pennylane as qml
dev = qml.device("lightning.kokkos", wires=24)

Error:

pennylane/devices/device_constructor.py", line 260, in device
    plugin_device_class = plugin_devices[name].load()
from pennylane_lightning.core import __version__
ModuleNotFoundError: No module named 'pennylane_lightning.core'

Additional info:
qml.about() gives:

Platform info:           Linux-5.14.21-150500.55.49_13.0.56-cray_shasta_c-x86_64-with-glibc2.31
Python version:          3.11.10
Numpy version:           1.26.4
Scipy version:           1.14.1
Installed devices:
- default.clifford (PennyLane-0.38.0)
- default.gaussian (PennyLane-0.38.0)
- default.mixed (PennyLane-0.38.0)
- default.qubit (PennyLane-0.38.0)
- default.qubit.autograd (PennyLane-0.38.0)
- default.qubit.jax (PennyLane-0.38.0)
- default.qubit.legacy (PennyLane-0.38.0)
- default.qubit.tf (PennyLane-0.38.0)
- default.qubit.torch (PennyLane-0.38.0)
- default.qutrit (PennyLane-0.38.0)
- default.qutrit.mixed (PennyLane-0.38.0)
- default.tensor (PennyLane-0.38.0)
- null.qubit (PennyLane-0.38.0)
- lightning.qubit (PennyLane_Lightning-0.38.0)
- lightning.kokkos (PennyLane_Lightning_Kokkos-0.38.0)

I could only build for OpenMP backend, when I try building for HIP it always fails. RocM version = 6.0.3

Hi @Modee, welcome to the Forum!

Have you tried installing it via Spack or Docker as shown here?

If this didn’t work, could you please copy-paste here the instructions you used to install from source?

I’m thinking it might be an issue of setting CMAKE_ARGS. They should be:

CMAKE_ARGS="-DKokkos_ENABLE_HIP=ON" python -m pip install -e . --config-settings editable_mode=compat -vv

However it’s best to first try installing via Spack or Docker before trying to install from source.

Thanks for the reply. Here is the instruction I used to install from source:

PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py

SKIP_COMPILATION=True pip install -e . --config-settings editable_mode=compat

PL_BACKEND="lightning_kokkos" python scripts/configure_pyproject_toml.py

CMAKE_ARGS="-DCMAKE_CXX_COMPILER=hipcc -DKokkos_ARCH_AMD_GFX90A=ON -DKokkos_ENABLE_HIP=ON -DKokkos_ENABLE_SERIAL=ON -DKokkos_ENABLE_OPENMP=ON -DPL_BACKEND=lightning_kokkos" python -m pip install -e . --config-settings editable_mode=compat -vv

I followed the instructions shown here: GitHub - PennyLaneAI/pennylane-lightning: The PennyLane-Lightning plugin provides a fast state-vector simulator written in C++ for use with PennyLane

Hi @Modee,

Is there any info you can share about the system you’re running on? What’s your architecture?

Does the following work? (You might need to add the CMake option for your specific architecture -DKokkos_ARCH_{...}=ON)

git clone https://github.com/PennyLaneAI/pennylane-lightning.git
cd pennylane-lightning
PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py
SKIP_COMPILATION=True pip install -e . --config-settings editable_mode=compat
PL_BACKEND="lightning_kokkos" python scripts/configure_pyproject_toml.py
CMAKE_ARGS="-DKokkos_ENABLE_HIP=ON" python -m pip install -e . --config-settings editable_mode=compat -vv