{"id":663,"library":"nvidia-cuda-runtime-cu12","title":"NVIDIA CUDA Runtime (CUDA 12)","description":"This package provides the native CUDA Runtime libraries as Python Wheels, enabling Python applications to leverage GPU acceleration by providing core runtime functionalities. It is part of NVIDIA's initiative to offer native Python support for CUDA, simplifying GPU-based parallel processing for high-performance computing, data science, and AI workloads. The current version is 12.9.79, with releases generally aligning with the NVIDIA CUDA Toolkit.","status":"active","version":"12.9.79","language":"python","source_language":"en","source_url":"https://developer.nvidia.com/cuda-python","tags":["cuda","nvidia","gpu","runtime","deep learning","machine learning"],"install":[{"cmd":"pip install nvidia-cuda-runtime-cu12","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Requires Python 3 or newer.","package":"Python","optional":false},{"reason":"Requires a CUDA-capable NVIDIA GPU to function.","package":"NVIDIA GPU","optional":false},{"reason":"Requires compatible and up-to-date NVIDIA GPU drivers.","package":"NVIDIA GPU Drivers","optional":false}],"imports":[{"note":"Users typically interact with CUDA through higher-level frameworks that depend on this runtime. To check for CUDA availability, you would use functions provided by those frameworks.","symbol":"Not directly imported","correct":"This package primarily provides native shared libraries. High-level Python libraries (e.g., PyTorch, TensorFlow, or the `cuda-python` project's `cuda.core` module) implicitly link against and utilize these runtime components, rather than requiring direct imports of `nvidia_cuda_runtime_cu12` itself in user code."}],"quickstart":{"code":"import torch\n\nif torch.cuda.is_available():\n    print(f\"CUDA is available! Version: {torch.version.cuda}\")\n    print(f\"Number of GPUs: {torch.cuda.device_count()}\")\n    print(f\"Current GPU name: {torch.cuda.get_device_name(0)}\")\nelse:\n    print(\"CUDA is not available. Please check your installation and drivers.\")","lang":"python","description":"While `nvidia-cuda-runtime-cu12` itself doesn't offer direct high-level Python APIs, its successful installation allows frameworks like PyTorch to leverage the CUDA runtime. This snippet demonstrates how to verify that a CUDA-enabled PyTorch (which depends on this runtime) can detect and utilize your GPU."},"warnings":[{"fix":"Ensure your NVIDIA GPU drivers are updated to a version compatible with CUDA 12.x. Check NVIDIA's official documentation for driver requirements corresponding to your specific CUDA version.","message":"Incompatible NVIDIA GPU drivers with the installed CUDA version can lead to runtime errors (e.g., 'CUDA driver version is insufficient'). The GPU driver must be sufficiently new to support the installed CUDA toolkit version.","severity":"breaking","affected_versions":"All versions"},{"fix":"For compilation, download and install the complete NVIDIA CUDA Toolkit from developer.nvidia.com/cuda-downloads alongside this runtime package. Ensure `nvcc` is in your system's PATH.","message":"This package provides CUDA runtime libraries, not the full CUDA development toolkit (e.g., it does not include `nvcc`). If you need to compile CUDA code (e.g., custom kernels or certain libraries from source), a separate, full CUDA Toolkit installation is required.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Manually add the CUDA binary and library paths (e.g., `/usr/local/cuda/bin`, `/usr/local/cuda/lib64` on Linux, or `%CUDA_PATH%\\bin`, `%CUDA_PATH%\\lib\\x64` on Windows) to your system's environment variables. Restart your shell or IDE after changes.","message":"CUDA binaries and libraries (like `cudart64_12.dll` on Windows or `libcudart.so.12` on Linux) need to be correctly discoverable via system environment variables (`PATH`, `LD_LIBRARY_PATH` on Linux, or `CUDA_PATH` on Windows). Incorrect setup can result in applications failing to find the CUDA runtime.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consult the NVIDIA CUDA Toolkit Release Notes and Programming Guide for details on deprecated features and API changes during major upgrades. Thoroughly test your applications after upgrading.","message":"When upgrading CUDA (especially major versions), some older APIs or functions might be deprecated or behave differently, potentially requiring modifications to existing CUDA C/C++ code.","severity":"gotcha","affected_versions":"Major version upgrades (e.g., CUDA 11 to CUDA 12)"},{"fix":"Set `CUDA_MODULE_LOADING=EAGER` in your environment before running the application. For example, `export CUDA_MODULE_LOADING=EAGER && python my_script.py` on Linux/macOS.","message":"For CUDA versions 12.2 and newer, applications that exhibit hanging during the first kernel launch might resolve the issue by setting the `CUDA_MODULE_LOADING` environment variable to `EAGER`.","severity":"gotcha","affected_versions":">=12.2"},{"fix":"Ensure that the 'torch' package is installed in your Python environment using pip (e.g., `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121` for CUDA 12.1, adjusting for your specific CUDA version or 'cpu' if no GPU is used). Verify that the correct Python interpreter and environment are being used.","message":"The 'torch' Python package is not installed or cannot be found in the current Python environment. This prevents the application from importing the necessary PyTorch libraries.","severity":"breaking","affected_versions":"All versions"},{"fix":"To install packages from the NVIDIA Python Package Index, first install the `nvidia-pyindex` package: `pip install nvidia-pyindex`. Then, proceed with the installation of the desired CUDA runtime package, e.g., `pip install nvidia-cuda-runtime-cu12`.","message":"The package you are trying to install (e.g., `nvidia-cuda-runtime-cu12`) is a placeholder on PyPI.org. These packages are hosted on the NVIDIA Python Package Index, and direct installation from PyPI will result in a runtime error indicating an incorrect package source.","severity":"breaking","affected_versions":"All versions of packages distributed via the NVIDIA Python Package Index"}],"env_vars":null,"last_verified":"2026-05-12T17:32:48.695Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Ensure the full NVIDIA CUDA Toolkit is installed and accessible in your system's PATH, or ensure that a compatible `nvcc` compiler is available in your environment if the package requires building CUDA extensions. For `nvidia-cuda-runtime-cu12` itself, ensure your `pip` and `setuptools` are up-to-date and consider installing `nvidia-pyindex` first: `pip install --upgrade setuptools pip wheel && pip install nvidia-pyindex`.","cause":"This error during `pip install` often indicates a failure in building a dependent package's metadata due to an improperly configured CUDA development environment, a missing CUDA Toolkit, or an incompatible `nvcc` compiler version.","error":"error: subprocess-exited-with-error × python setup.py egg_info did not run successfully."},{"fix":"Debug your CUDA code for memory access violations. For Python libraries, ensure correct input shapes and data types, update GPU drivers, or try setting `CUDA_LAUNCH_BLOCKING=1` environment variable for synchronous error reporting during debugging.","cause":"This runtime error typically points to an issue where a CUDA kernel attempts to access memory it doesn't have permission for, often due to out-of-bounds access, invalid pointers, or driver/hardware issues.","error":"RuntimeError: CUDA error: an illegal memory access was encountered"},{"fix":"Ensure the NVIDIA CUDA Toolkit and cuDNN (if needed) are properly installed, and their library paths are added to your system's `LD_LIBRARY_PATH` environment variable on Linux (e.g., `export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH`) or to the system PATH on Windows.","cause":"This error (or similar for other .so or .dll files like `libcublas.so.12`, `libcusparse.so.12`) means that a required CUDA-dependent dynamic library cannot be found by the system's dynamic linker, often because its path is not included in `LD_LIBRARY_PATH` (Linux) or it's missing on the system (Windows: `OSError: [WinError 126] The specified module could not be found`).","error":"ImportError: libcudnn.so.9: cannot open shared object file: No such file or directory"},{"fix":"Ensure your NVIDIA GPU drivers are up-to-date. If compiling CUDA code, ensure it's compiled for the correct compute capability of your GPU. For pre-built binaries (like PyTorch wheels), ensure you've installed the version compatible with your GPU's CUDA capability and your installed CUDA runtime.","cause":"This error occurs when the GPU cannot find a suitable 'kernel image' to execute, usually due to a mismatch between the compiled CUDA code's compute capability and the actual GPU's architecture, or an outdated GPU driver.","error":"RuntimeError: CUDA error: no kernel image is available for execution on the device"},{"fix":"Verify your CUDA Toolkit installation. Run `python -m bitsandbytes` (or the equivalent for the failing library) to inspect CUDA library paths. Add the necessary CUDA library directories to your `LD_LIBRARY_PATH` environment variable.","cause":"This specific error, often reported by higher-level libraries (e.g., `bitsandbytes`), indicates that while a GPU is detected, the library cannot properly initialize or interact with the CUDA environment, often due to incorrect `LD_LIBRARY_PATH` settings or an incomplete CUDA installation.","error":"RuntimeError: CUDA Setup failed despite GPU being available."}],"ecosystem":"pypi","meta_description":null,"install_score":0,"install_tag":"stale","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"12.9.79","install_checks":{"last_tested":"2026-05-12","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":1,"wheel_type":null,"failure_reason":"build_error","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.6,"import_time_s":null,"mem_mb":null,"disk_size":"28M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":1,"wheel_type":null,"failure_reason":"build_error","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.7,"import_time_s":null,"mem_mb":null,"disk_size":"29M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":1,"wheel_type":null,"failure_reason":"build_error","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.6,"import_time_s":null,"mem_mb":null,"disk_size":"21M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":1,"wheel_type":null,"failure_reason":"build_error","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.6,"import_time_s":null,"mem_mb":null,"disk_size":"21M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":" $EXIT -eq 0 ","exit_code":1,"wheel_type":null,"failure_reason":"build_error","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":" $EXIT -eq 0 ","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.8,"import_time_s":null,"mem_mb":null,"disk_size":"27M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}