Issues with lightning.tensor device

Hello!

I’ve been trying to use the lightning.tensor device to run some efficient quantum circuit simulations. I’m currently running these on a server using an NVIDIA A100-SXM4-80GB.

I have followed the installation process suggested here: Install — PennyLane. In addition, I have been able to use the lightning.gpu device without issues. However, when using the the lightning.tensor device as follows:

from qiskit import QuantumCircuit
import pennylane as qml
from pennylane_qiskit.converter import load
import numpy as np

filename = "qiskit_circuit_file.qasm"

# Load the Qiskit circuit from a QASM file
qiskit_circuit = QuantumCircuit.from_qasm_file(filename)

# Convert to a PennyLane circuit
pl_circuit = load(qiskit_circuit)

kwargs_mps = {"max_bond_dim": 64, "cutoff": 1e-10, "cutoff_mode": "abs",}
    
dev = qml.device('lightning.tensor', method='mps', **kwargs_mps)

@qml.qnode(dev)
def circuit():
    pl_circuit()  # applies the gates from Qiskit
    return qml.expval(qml.PauliZ(0))

exp_val = circuit()
print(exp_val)

I will get the following error message:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[14], line 18
     14 pl_circuit = load(qiskit_circuit)
     16 kwargs_mps = {"max_bond_dim": 64, "cutoff": 1e-10, "cutoff_mode": "abs",}
---> 18 dev = qml.device('lightning.tensor', method='mps', **kwargs_mps)
     19 # dev = qml.device('lightning.gpu', wires=num_qubits)
     22 @qml.qnode(dev)
     23 def circuit():

File ~/micromamba/envs/cuquantum_v25.03.0/lib/python3.12/site-packages/pennylane/devices/device_constructor.py:263, in device(name, *args, **kwargs)
    257         raise qml.DeviceError(
    258             f"The {name} plugin requires PennyLane versions {required_versions}, "
    259             f"however PennyLane version {qml.version()} is installed."
    260         )
    262 # Construct the device
--> 263 dev = plugin_device_class(*args, **options)
    265 # Once the device is constructed, we set its custom expansion function if
    266 # any custom decompositions were specified.
    267 if custom_decomps is not None:

File ~/micromamba/envs/cuquantum_v25.03.0/lib/python3.12/site-packages/pennylane_lightning/lightning_tensor/lightning_tensor.py:315, in LightningTensor.__init__(self, wires, shots, method, c_dtype, **kwargs)
    305 def __init__(
    306     self,
    307     *,
   (...)    312     **kwargs,
    313 ):
    314     if not self._CPP_BINARY_AVAILABLE:
--> 315         raise ImportError("Pre-compiled binaries for lightning.tensor are not available. ")
    317     if not accepted_methods(method):
    318         raise ValueError(
    319             f"Unsupported method: {method}. Supported methods are 'mps' (Matrix Product State) and 'tn' (Exact Tensor Network)."
    320         )

ImportError: Pre-compiled binaries for lightning.tensor are not available. 

The relevant NVIDIA packages that I have installed are:

cudensitymat-cu12==0.1.0
cupy-cuda12x==13.4.0
cuquantum-python-cu12==25.3.0
custatevec-cu12==1.8.0
cutensor-cu12==2.2.0
cutensornet-cu12==2.7.0

And these are the Pennylane and respective packages I’ve been using as per the qml.about() output:

Name: PennyLane
Version: 0.40.0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author: 
Author-email: 
License: Apache License 2.0
Location: /home/miguel.angellopezruiz/micromamba/envs/cuquantum_v25.03.0/lib/python3.12/site-packages
Requires: appdirs, autograd, autoray, cachetools, diastatic-malt, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, tomlkit, typing-extensions
Required-by: PennyLane-qiskit, PennyLane_Lightning, PennyLane_Lightning_GPU, PennyLane_Lightning_Tensor

Platform info:           Linux-6.8.0-53-generic-x86_64-with-glibc2.39
Python version:          3.12.9
Numpy version:           2.0.2
Scipy version:           1.15.2
Installed devices:
- qiskit.aer (PennyLane-qiskit-0.40.1)
- qiskit.basicaer (PennyLane-qiskit-0.40.1)
- qiskit.basicsim (PennyLane-qiskit-0.40.1)
- qiskit.remote (PennyLane-qiskit-0.40.1)
- lightning.qubit (PennyLane_Lightning-0.40.0)
- default.clifford (PennyLane-0.40.0)
- default.gaussian (PennyLane-0.40.0)
- default.mixed (PennyLane-0.40.0)
- default.qubit (PennyLane-0.40.0)
- default.qutrit (PennyLane-0.40.0)
- default.qutrit.mixed (PennyLane-0.40.0)
- default.tensor (PennyLane-0.40.0)
- null.qubit (PennyLane-0.40.0)
- reference.qubit (PennyLane-0.40.0)
- lightning.gpu (PennyLane_Lightning_GPU-0.40.0)
- lightning.tensor (PennyLane_Lightning_Tensor-0.40.0)

Could you please help me figure out the issue?

Thanks!

Hi @loruma , welcome to the Forum!

NVIDIA updated their packages recently, so it’s likely that some older libraries are now causing silent conflicts.

Are you able to create a separate venv (not mamba env) and install there?

On the other hand, in your example you’ll need a wires=x argument.

Let us know if using venv helps solve your issue!

Hi @CatalinaAlbornoz , thanks for the very prompt response and so sorry for the late reply. Unfortunately, I can’t use env, so perhaps there is indeed some issues with the latest CuQuantum version.

Regarding wires=x argument, I did forget to input that in the lightning.tensor example; however, it does not seem to be necessary with the default.tensor device when loading a qiskit circuit the way I did it.

Thanks!

Thanks for your response @loruma !

Let us know in case downgrading the version of CuQuantum doesn’t solve the issue.