Hello there,
I was trying to use the cuda_quantum compiler in combination with jax qjit. Unfortunately, pennnylane can’t find the cuda_quantum package even though it is installed via ‘pip install cudaq’ (cuda_quantum does not exist anymore as fare as I can say). The issue occures first when while defining a device that supports the cuda_quantum compiler. A minimal example is shown below.
Does a workaround exist?
Example:
import pennylane as qml
dev = qml.device(“nvidia.custatevec”, wires=2)
Error msg:
StopIteration Traceback (most recent call last)
File /opt/conda/lib/python3.11/importlib/metadata/init.py:563, in Distribution.from_name(cls, name)
562 try:
→ 563 return next(cls.discover(name=name))
564 except StopIteration:
StopIteration:
During handling of the above exception, another exception occurred:
PackageNotFoundError Traceback (most recent call last)
Cell In[1], line 2
1 import pennylane as qml
----> 2 dev = qml.device(“nvidia.custatevec”, wires=2)
File /opt/conda/lib/python3.11/site-packages/pennylane/devices/device_constructor.py:266, in device(name, *args, **kwargs)
260 raise qml.DeviceError(
261 f"The {name} plugin requires PennyLane versions {required_versions}, "
262 f"however PennyLane version {qml.version()} is installed."
263 )
265 # Construct the device
→ 266 dev = plugin_device_class(*args, **options)
268 # Once the device is constructed, we set its custom expansion function if
269 # any custom decompositions were specified.
270 if custom_decomps is not None:
File /opt/conda/lib/python3.11/site-packages/catalyst/third_party/cuda/init.py:223, in NvidiaCuStateVec.init(self, shots, wires, multi_gpu)
221 def init(self, shots=None, wires=None, multi_gpu=False): # pragma: no cover
222 self.multi_gpu = multi_gpu
→ 223 super().init(wires=wires, shots=shots)
File /opt/conda/lib/python3.11/site-packages/catalyst/third_party/cuda/init.py:137, in BaseCudaInstructionSet.init(self, shots, wires)
136 def init(self, shots=None, wires=None):
→ 137 _check_version_compatibility()
138 super().init(wires=wires, shots=shots)
File /opt/conda/lib/python3.11/site-packages/catalyst/third_party/cuda/init.py:26, in _check_version_compatibility()
25 def _check_version_compatibility():
—> 26 installed_version = version(“cuda_quantum”)
27 compatible_version = “0.6.0”
28 if installed_version != compatible_version:
File /opt/conda/lib/python3.11/importlib/metadata/init.py:1009, in version(distribution_name)
1002 def version(distribution_name):
1003 “”“Get the version string for the named package.
1004
1005 :param distribution_name: The name of the distribution package to query.
1006 :return: The version string for the package as defined in the package’s
1007 “Version” metadata key.
1008 “””
→ 1009 return distribution(distribution_name).version
File /opt/conda/lib/python3.11/importlib/metadata/init.py:982, in distribution(distribution_name)
976 def distribution(distribution_name):
977 “”“Get the Distribution
instance for the named package.
978
979 :param distribution_name: The name of the distribution package as a string.
980 :return: A Distribution
instance (or subclass thereof).
981 “””
→ 982 return Distribution.from_name(distribution_name)
File /opt/conda/lib/python3.11/importlib/metadata/init.py:565, in Distribution.from_name(cls, name)
563 return next(cls.discover(name=name))
564 except StopIteration:
→ 565 raise PackageNotFoundError(name)
PackageNotFoundError: No package metadata was found for cuda_quantum
qml.about():
Name: PennyLane
Version: 0.41.1
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: GitHub - PennyLaneAI/pennylane: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Built by researchers, for research.
Author:
Author-email:
License: Apache License 2.0
Location: /opt/conda/lib/python3.11/site-packages
Requires: appdirs, autograd, autoray, cachetools, diastatic-malt, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, tomlkit, typing-extensions
Required-by: PennyLane-Catalyst, PennyLane_Lightning, PennyLane_Lightning_GPU, PennyLane_Lightning_Kokkos
Platform info: Linux-5.15.0-134-generic-x86_64-with-glibc2.35
Python version: 3.11.10
Numpy version: 2.2.6
Scipy version: 1.16.0
Installed devices:
- lightning.kokkos (PennyLane_Lightning_Kokkos-0.41.1)
- default.clifford (PennyLane-0.41.1)
- default.gaussian (PennyLane-0.41.1)
- default.mixed (PennyLane-0.41.1)
- default.qubit (PennyLane-0.41.1)
- default.qutrit (PennyLane-0.41.1)
- default.qutrit.mixed (PennyLane-0.41.1)
- default.tensor (PennyLane-0.41.1)
- null.qubit (PennyLane-0.41.1)
- reference.qubit (PennyLane-0.41.1)
- lightning.qubit (PennyLane_Lightning-0.41.1)
- nvidia.custatevec (PennyLane-Catalyst-0.11.0)
- nvidia.cutensornet (PennyLane-Catalyst-0.11.0)
- oqc.cloud (PennyLane-Catalyst-0.11.0)
- softwareq.qpp (PennyLane-Catalyst-0.11.0)
- lightning.gpu (PennyLane_Lightning_GPU-0.41.1)