Registry / ai-ml / nvidia-cusparse-cu11

nvidia-cusparse-cu11

JSON →
library11.7.5.86pypypiunverified

The `nvidia-cusparse-cu11` package provides the native runtime libraries for NVIDIA's cuSPARSE, a GPU-accelerated library offering basic linear algebra subroutines for sparse matrix computations. It is an essential low-level component for high-performance computing, machine learning, and AI applications that leverage sparse matrices on NVIDIA GPUs with CUDA Toolkit 11.x. The current version is 11.7.5.86, with the last major version release on October 18, 2022, indicating a slow release cadence for this specific Python wrapper version, though the underlying C++ library continues to evolve.

pip install nvidia-cusparse-cu11
INSTALL
IMPORT
SIG · NVIDIA-CUSPARSE-CU
N
nvidia-cusparse-cu11
ai-mlpythonv11.7.5.86
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

The `nvidia-cusparse-cu11` package is a low-level runtime dependency and does not expose direct Python APIs. Its functionality is implicitly used by higher-level deep learning and scientific computing libraries like PyTorch or CuPy. This quickstart demonstrates how to check for CUDA availability using PyTorch, which, when successful, confirms the underlying NVIDIA libraries (including cuSPARSE) are accessible for sparse tensor operations.

import torch import os # Check for CUDA availability, which indirectly means cuSPARSE (if torch uses it) can be leveraged. if torch.cuda.is_available(): print(f"CUDA is available. Device name: {torch.cuda.get_device_name(0)}") # Example of a sparse tensor, which relies on underlying sparse matrix libraries like cuSPARSE # This package provides the *runtime* for such operations, not direct Python APIs. i = torch.tensor([[0, 1, 1], [2, 0, 2]]) v = torch.tensor([3, 4, 5], dtype=torch.float32) size = torch.Size([2, 3]) if torch.cuda.device_count() > 0: sparse_tensor_cpu = torch.sparse_coo_tensor(i, v, size) print(f"Sparse tensor on CPU:\n{sparse_tensor_cpu}") # Move to GPU if available sparse_tensor_gpu = sparse_tensor_cpu.to('cuda') print(f"Sparse tensor on GPU:\n{sparse_tensor_gpu}") print("This operation implicitly leverages NVIDIA's sparse computation libraries.") else: print("No CUDA devices found, cannot create sparse tensor on GPU.") else: print("CUDA is not available. Please ensure NVIDIA drivers and CUDA Toolkit 11.x are installed.")
Debug
Known issues
breakingCUDA Toolkit Version Mismatch: The `cu11` in the package name explicitly indicates compatibility with NVIDIA CUDA Toolkit 11.x. Installing this package with a system that has a different major CUDA version (e.g., CUDA 10.x or 12.x) will lead to runtime errors, `ImportError` exceptions in dependent libraries (like PyTorch), or incorrect behavior.
fix
Ensure your system's NVIDIA CUDA Toolkit version matches the 'cuXX' suffix in the Python package name (e.g., `nvidia-cusparse-cu11` requires CUDA 11.x). Use `nvcc --version` to check your CUDA version. For PyTorch, ensure you install the PyTorch version compiled for the matching CUDA version.
affects: All versions
gotchaNo Direct Python API: This package provides native runtime libraries and does not expose a direct Python API (e.g., `import nvidia.cusparse` will fail). Its purpose is to serve as a backend dependency for other Python libraries (like `torch-cuda` or `cupy`) that wrap cuSPARSE's C/C++ functionality. Users expecting direct Python bindings will not find them here.
fix
Utilize higher-level libraries such as PyTorch (`torch.sparse`) or CuPy, which are designed to interface with the underlying cuSPARSE functionality. These libraries handle the low-level interactions transparently.
affects: All versions
gotchaProprietary License: The `nvidia-cusparse-cu11` package is distributed under an 'NVIDIA Proprietary Software' license. This may have implications for redistribution or use in certain commercial or open-source projects.
fix
Review the NVIDIA Proprietary Software License agreement to ensure compliance with its terms for your specific use case.
affects: All versions
gotchaLarge File Size and Download Issues: The wheel files for this package are substantial (over 200 MB). Incomplete downloads or 'No space left on device' errors, even with seemingly sufficient disk space, have been reported during installation.
fix
Ensure ample free disk space (at least several GBs) in your installation environment and temporary directories. A stable internet connection is also recommended. If issues persist, clear pip's cache (`pip cache purge`) and retry installation.
affects: All versions
deprecatedDeprecated cuSPARSE C/C++ APIs: The underlying cuSPARSE library has undergone API changes. Specifically, some older interfaces were deprecated in CUDA 10.1 and removed in CUDA 11.0. Projects using direct C/C++ calls to deprecated cuSPARSE functions might encounter compilation or runtime issues if upgrading to CUDA 11.x toolkits, even if this Python package is present.
fix
Developers working with C/C++ code that links against cuSPARSE should consult the official NVIDIA cuSPARSE documentation for the CUDA 11.x toolkit to update any deprecated API calls to the newer, supported interfaces.
affects: Libraries compiled against older cuSPARSE APIs when used with CUDA 11.x
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'nvidia_cusparse_cu11'
The `nvidia-cusparse-cu11` Python package has not been installed in the current Python environment, or the Python interpreter cannot locate the installed package.
fix
Ensure you are in the correct virtual environment (if applicable) and install the package using pip: `pip install nvidia-cusparse-cu11`
RuntimeError: Unable to load cuSPARSE. Is it installed?
This error typically indicates that the underlying NVIDIA cuSPARSE native library (part of the CUDA Toolkit) is either not installed, not accessible via system library paths (like `LD_LIBRARY_PATH` on Linux), or its version is incompatible with the `nvidia-cusparse-cu11` Python package or a dependent library (e.g., JAX, PyTorch) that attempts to use it.
fix
Verify that the CUDA Toolkit is correctly installed and its `lib` directory is included in your system's `LD_LIBRARY_PATH` (Linux/macOS) or `PATH` (Windows). Also, ensure that your NVIDIA GPU driver and CUDA Toolkit versions are compatible. Sometimes, unsetting `LD_LIBRARY_PATH` can resolve conflicts if it's pointing to older or incorrect CUDA installations. If using a framework like JAX or PyTorch, ensure that `jaxlib` or `torch` versions are compatible with your installed CUDA Toolkit version.
ImportError: /.../libcusparse.so.12: undefined symbol: __nvJitLinkAddData_12_1, version libnvJitLink.so.12
This indicates a dynamic linking issue where the `libcusparse.so` library loaded has unresolved symbols or an incompatibility with other NVIDIA libraries (like `libnvJitLink.so`) in the environment. This often arises from a mismatch between the CUDA runtime version used to compile a dependent library (e.g., PyTorch) and the CUDA Toolkit/driver installed on the system, leading to conflicting versions of shared libraries being loaded.
fix
Ensure a consistent CUDA environment. This often involves: 1. Aligning your NVIDIA driver, CUDA Toolkit, and any dependent libraries (like PyTorch or JAX) to compatible versions. 2. Reinstalling dependent libraries if they were built against a different CUDA version than currently installed. 3. Checking for and potentially clearing conflicting `LD_LIBRARY_PATH` entries that might point to older CUDA installations. Downgrading the dependent library (e.g., PyTorch to 2.0.1 as per a common workaround) might also resolve the conflict.
ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device
During the installation of `nvidia-cusparse-cu11` (or any large package), the system runs out of disk space in the temporary directory used by pip or in the target installation directory.
fix
Free up disk space on your system, especially in the partition where Python packages are installed or where temporary files are stored. You can also configure pip to use a different temporary directory with the `TMPDIR` environment variable.
Upgrade
Version history
11.7.5.86latest on PyPI · released Oct 18, 2022
Audit
Dependencies
NVIDIA CUDA Toolkit (11.x series)requiredThis Python package provides bindings to the native cuSPARSE library, which requires a compatible system-wide CUDA Toolkit installation (specifically 11.x versions, indicated by 'cu11' in the package name) to function correctly on NVIDIA GPUs.
Agent activity
5 hits · last 30 days
node
4
Resources