cuda-pathfinder is a Python library from NVIDIA that provides utilities for locating CUDA components, such as dynamic libraries (.so, .dll) and CUDA Toolkit (CTK) header directories. It aims to be a one-stop solution for discovering CUDA artifacts within a Python environment. It is currently at version 1.5.0 and is part of the broader NVIDIA CUDA Python ecosystem, undergoing active development with regular releases.
pip install cuda-pathfinderVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `cuda-pathfinder` to locate and load an NVIDIA dynamic library, such as the CUDA Runtime library (`cudart`). It highlights the primary use case of finding system-level CUDA components within a Python environment. The example includes error handling for when the library is not found.
Avoid calling OS-specific `close` functions on `LoadedDL._handle_uint`. The library manages the lifecycle of loaded dynamic libraries internally.
Ensure that the installed CUDA Toolkit version falls within NVIDIA's supported range for `cuda-pathfinder` to function reliably. Refer to the `cuda-python` documentation for specific compatibility matrices.
Verify and correctly set CUDA-related environment variables for your desired CUDA Toolkit version. Tools like `nvcc --version` and `nvidia-smi` can help diagnose the active CUDA environment. Ensure consistency between your environment setup and the components you expect `cuda-pathfinder` to find.
Update your understanding and installation scripts to reflect the modular nature of `cuda-python` and its subpackages. Install `cuda-pathfinder` explicitly as `pip install cuda-pathfinder` rather than relying on a `cuda-python` metapackage to implicitly include it if explicit control is desired.
To resolve this, install the library using pip: `pip install cuda-pathfinder`. If the issue persists in a complex build environment, refer to the official documentation or issue trackers for specific workarounds related to namespace package resolution.
Verify that your CUDA Toolkit installation is complete and accessible. Ensure that relevant environment variables such as `CUDA_PATH`, `LD_LIBRARY_PATH` (Linux), or system `PATH` (Windows) correctly point to the CUDA installation's `bin` and `lib` directories.
Consult the `cuda-pathfinder` documentation, specifically `cuda.pathfinder.SUPPORTED_NVIDIA_LIBNAMES`, for a list of valid library names and ensure you are using one of the supported names.
Ensure that the NVIDIA dynamic library you are attempting to load is compatible with your current operating system and hardware configuration.