{"id":738,"library":"nvidia-cuda-nvrtc-cu12","title":"NVIDIA CUDA NVRTC for CUDA 12.x","description":"NVRTC (NVIDIA Runtime Compiler) is a library designed for runtime compilation of CUDA C++ source code into PTX (Parallel Thread Execution) assembly. This Python package, `nvidia-cuda-nvrtc-cu12`, provides the native runtime libraries (DLLs/SOs) for CUDA 12.x, enabling dynamic code generation and execution on NVIDIA GPUs. It's a fundamental component of the CUDA Toolkit, actively maintained by NVIDIA, and crucial for other Python libraries that leverage JIT CUDA compilation.","status":"active","version":"12.9.86","language":"python","source_language":"en","source_url":"https://docs.nvidia.com/cuda/nvrtc/index.html","tags":["cuda","nvidia","gpu","compiler","runtime","jit"],"install":[{"cmd":"pip install nvidia-cuda-nvrtc-cu12","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"This package provides native runtime libraries that require a compatible NVIDIA GPU and an installed NVIDIA display driver to function correctly.","package":"NVIDIA CUDA-capable GPU and Driver","optional":false},{"reason":"While this package provides runtime libraries, full CUDA development (e.g., using `nvcc`, headers) typically requires the complete CUDA Toolkit installed separately.","package":"CUDA Toolkit (Developer)","optional":true}],"imports":[],"quickstart":{"code":"import os\n\n# This package primarily provides native runtime libraries (DLLs/SOs)\n# for CUDA's NVRTC component, which are consumed by other higher-level\n# CUDA-enabled Python libraries (e.g., PyTorch, CuPy) for JIT compilation.\n# There is no direct Python API exposed by this specific package for end-user import.\n# The following code demonstrates verifying CUDA's availability, which implicitly\n# relies on the correctly installed underlying CUDA runtime components like NVRTC.\n\ntry:\n    import torch\n    print(f\"PyTorch CUDA available: {torch.cuda.is_available()}\")\n    if torch.cuda.is_available():\n        print(f\"PyTorch CUDA version: {torch.version.cuda}\")\n        print(f\"Current CUDA device: {torch.cuda.get_device_name(0)}\")\nexcept ImportError:\n    print(\"PyTorch not installed. Cannot verify CUDA availability via PyTorch.\")\n\ntry:\n    import cupy\n    print(f\"CuPy CUDA available: {cupy.cuda.is_available()}\")\n    if cupy.cuda.is_available():\n        print(f\"CuPy CUDA version: {cupy.cuda.runtime.get_version()}\")\n        print(f\"Current CUDA device: {cupy.cuda.Device(0).name}\")\nexcept ImportError:\n    print(\"CuPy not installed. Cannot verify CUDA availability via CuPy.\")\n\n# A successful installation of nvidia-cuda-nvrtc-cu12 means these libraries\n# are available for use by such frameworks.","lang":"python","description":"The `nvidia-cuda-nvrtc-cu12` package does not expose a direct Python API for end-user import. Instead, it provides the underlying native NVRTC runtime libraries that are consumed by other CUDA-enabled Python frameworks like PyTorch or CuPy. This quickstart demonstrates verifying CUDA's availability using these frameworks, which implicitly confirms that `nvidia-cuda-nvrtc-cu12` is correctly installed as a runtime component. You might need to install `torch` or `cupy` separately (e.g., `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121` or `pip install cupy-cuda12x`)."},"warnings":[{"fix":"Ensure your NVIDIA GPU driver is up-to-date and compatible with the CUDA toolkit version (indicated by 'cu12' in the package name). Consult NVIDIA's CUDA compatibility matrix.","message":"CUDA Python wheels, including `nvidia-cuda-nvrtc-cu12`, require a compatible NVIDIA GPU driver installed on the system. Mismatched driver versions (e.g., an older driver with a newer CUDA toolkit version or vice-versa) can lead to runtime errors or GPU features being unavailable.","severity":"breaking","affected_versions":"All versions"},{"fix":"If you need to compile CUDA C++ code or access CUDA headers, install the full CUDA Toolkit from NVIDIA's developer website alongside the Python runtime components.","message":"This package is intended for 'runtime use' and provides native shared libraries (like `.dll` or `.so` files). It *does not* include developer tools, headers, or the `nvcc` compiler itself. For full CUDA development workflows, the complete NVIDIA CUDA Toolkit must be installed separately.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Do not expect to `import nvrtc` or similar directly. Instead, utilize higher-level Python libraries that wrap CUDA functionality. This package is an underlying runtime dependency for them.","message":"The `nvidia-cuda-nvrtc-cu12` package does not expose a direct Python API or symbols for import by end-user Python code. Its primary role is to provide the native NVRTC libraries that other Python packages (e.g., PyTorch, CuPy, JAX) link against and use internally for Just-In-Time (JIT) compilation of CUDA C++ kernels.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For applications with high security requirements, regularly review security reports (e.g., from tools like ReversingLabs) and ensure consistent toolchain versions for all linked components. Consult programming language toolchain documentation (e.g., for Microsoft VisualStudio, use `/guard:cf`).","message":"Security analyses of `nvidia-cuda-nvrtc-cu12` have occasionally flagged 'reduced effectiveness mitigations' for vulnerabilities when statically linked libraries from different toolchain versions are combined. This can impact the integrity of control flow protection mechanisms.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install PyTorch, CuPy, or other Python libraries that utilize `nvidia-cuda-nvrtc-cu12` to enable comprehensive testing and full functional access.","message":"To fully test or utilize `nvidia-cuda-nvrtc-cu12` effectively, ensure higher-level CUDA-enabled libraries like PyTorch or CuPy are installed. As this package primarily provides underlying runtime functionality, direct verification of CUDA availability or JIT compilation might be limited without these consumers.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install the `nvidia-pyindex` package first to configure pip to use the NVIDIA Python Package Index, then install `nvidia-cuda-nvrtc-cu12`. Example: `pip install nvidia-pyindex && pip install nvidia-cuda-nvrtc-cu12`","message":"This package is a placeholder on PyPI.org. To install it, you must first configure pip to use the NVIDIA Python Package Index.","severity":"breaking","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T08:48:25.050Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Ensure that the CUDA Toolkit is correctly installed and that the directory containing `nvrtc-builtins64_XXX.dll` (e.g., `C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.x\\bin` on Windows) or `libnvrtc.so` (e.g., `/usr/local/cuda/lib64` on Linux) is included in your system's PATH or LD_LIBRARY_PATH environment variable. If using a Python environment, activate it and ensure necessary CUDA libraries are discoverable, or consider reinstalling the `nvidia-cuda-nvrtc-cu12` package within that environment.","cause":"This error typically occurs on Windows when the NVRTC built-in library (or a similar NVRTC DLL/shared object file like `libnvrtc.so` on Linux) cannot be found or loaded by the application at runtime, often due to incorrect installation, PATH issues, or environment mismatches.","error":"nvrtc: error: failed to open nvrtc-builtins64_124.dll. Make sure that nvrtc-builtins64_124.dll is installed correctly."},{"fix":"Verify that the CUDA Toolkit is installed and the `libnvrtc.so` file exists in a standard CUDA library directory (e.g., `/usr/local/cuda/lib64`). Ensure that this directory is included in your `LD_LIBRARY_PATH` environment variable. If using an Anaconda/Conda environment, ensure CUDA-related packages are installed correctly within that environment, or try setting `CUDA_HOME` to your CUDA installation path.","cause":"This error indicates that a Python library attempting to use NVRTC cannot locate the `libnvrtc.so` shared library on Linux-based systems, usually because the CUDA Toolkit is not installed, or its library paths are not correctly configured for the Python environment.","error":"RuntimeError: Could not find libnvrtc.so. Please make sure CUDA is installed."},{"fix":"Review the CUDA C++ source code being passed to NVRTC for any syntax errors or unsupported features. Check the compilation options being used (e.g., `--std=c++11`). Ensure that the CUDA Toolkit and NVRTC library versions are compatible with the code and the consuming application. Sometimes, updating or downgrading dependent libraries like CuPy might resolve underlying compatibility issues.","cause":"This error signifies a failure during the runtime compilation of CUDA C++ source code by NVRTC, often due to syntax errors in the provided CUDA kernel code, incompatible compiler options, or an issue with the NVRTC environment itself.","error":"NVRTCError: NVRTC_ERROR_COMPILATION (6)"},{"fix":"To resolve dependency conflicts, install PyTorch (or TensorFlow) and its CUDA dependencies together using the official installation instructions (e.g., from `pytorch.org`) which provide a command to install all compatible `nvidia-cuda-*` packages. Alternatively, manually specify compatible versions for `nvidia-cuda-nvrtc-cu12` and other `nvidia-cuda-*` packages that match the requirements of your main deep learning framework. Using a fresh virtual environment is highly recommended.","cause":"This pip error occurs when there's a version mismatch between `nvidia-cuda-nvrtc-cu12` (or other `nvidia-cuda-*` packages) and other core deep learning libraries like PyTorch or TensorFlow, which have strict dependencies on specific CUDA component versions.","error":"ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. torch 2.3.1 requires nvidia-cuda-nvrtc-cu12==12.1.105; ... but you have nvidia-cuda-nvrtc-cu12 12.3.107 which is incompatible."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":30,"quickstart_tag":"draft","pypi_latest":null,"quickstart_checks":{"last_tested":"2026-04-24","tag":"draft","tag_description":"notable failures across runtimes","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":0}]}}