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.
pip install nvidia-cuda-nvrtc-cu12No compatibility data collected yet for this library.
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`).
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.
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.
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.
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`).
Install PyTorch, CuPy, or other Python libraries that utilize `nvidia-cuda-nvrtc-cu12` to enable comprehensive testing and full functional access.
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`
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.
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.
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.
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.