{"id":4137,"library":"nvidia-cuda-nvcc-cu12","title":"CUDA nvcc Compiler (CUDA 12)","description":"The `nvidia-cuda-nvcc-cu12` package provides the NVIDIA CUDA C/C++ compiler (`nvcc`) as a Python wheel for CUDA Toolkit version 12. It enables Python-based build systems and projects (e.g., those using PyTorch, Numba, or CuPy for custom CUDA kernels) to access the `nvcc` executable for compiling CUDA code. This package is part of NVIDIA's initiative to streamline CUDA toolkit component installation via `pip`, aiming for better portability and compatibility within the Python ecosystem. The current version is 12.9.86, and NVIDIA typically updates CUDA versions with new GPU architectures, alongside quarterly minor releases.","status":"active","version":"12.9.86","language":"en","source_language":"en","source_url":"https://pypi.org/project/nvidia-cuda-nvcc-cu12/","tags":["cuda","nvidia","nvcc","compiler","gpu","deep learning","machine learning","toolchain"],"install":[{"cmd":"pip install nvidia-cuda-nvcc-cu12","lang":"bash","label":"Install `nvcc` for CUDA 12"}],"dependencies":[{"reason":"Often co-installed to provide the core CUDA runtime libraries necessary for executing compiled CUDA code.","package":"nvidia-cuda-runtime-cu12","optional":false}],"imports":[{"note":"Python projects typically interact with `nvcc` by invoking it as an external process (e.g., via `subprocess` or specialized build extensions like PyTorch's `CUDAExtension`).","symbol":"nvcc","correct":"This package provides the `nvcc` executable on the system's PATH. It is not a Python module with direct `import` statements."}],"quickstart":{"code":"import subprocess\nimport os\n\ntry:\n    # Attempt to run nvcc --version to verify installation\n    result = subprocess.run(['nvcc', '--version'], capture_output=True, text=True, check=True)\n    print(\"nvcc is installed and accessible:\")\n    print(result.stdout)\nexcept FileNotFoundError:\n    print(\"Error: nvcc command not found. Ensure it's in your system's PATH.\")\nexcept subprocess.CalledProcessError as e:\n    print(f\"Error running nvcc: {e}\")\n    print(f\"Stderr: {e.stderr}\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to verify that the `nvcc` compiler executable, provided by this package, is correctly installed and accessible in the system's PATH, by checking its version. This confirms the package's core utility is available for subsequent build processes."},"warnings":[{"fix":"Do not attempt `import nvidia_cuda_nvcc_cu12`. Instead, ensure `nvcc` is in your system's PATH and call it via `subprocess` or integrated build tools.","message":"This package primarily provides the `nvcc` *compiler executable* on your system's PATH, rather than a Python library with direct `import`able modules. Python projects interact with `nvcc` by invoking it as an external process (e.g., via `subprocess` calls or through framework-specific build extensions like PyTorch's `CUDAExtension`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure you have a compatible NVIDIA GPU driver installed directly from NVIDIA's website or your operating system's package manager, separate from this Python package.","message":"Installing `nvidia-cuda-nvcc-cu12` via `pip` delivers the `nvcc` compiler and associated tools, but it does *not* install the NVIDIA GPU driver. A compatible and correctly installed NVIDIA GPU driver is a separate, fundamental prerequisite for using CUDA-enabled applications and for `nvcc` to function correctly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Strive to use CUDA Toolkit components that are all from the same major.minor release. When building complex projects, check CUDA documentation for component version compatibility matrices.","message":"While CUDA follows semantic versioning, ensuring compatibility between different CUDA Toolkit components (such as `nvcc`, `nvrtc`, `nvjitlink`, and various CUDA libraries like `cuBLAS`, `cuFFT`) is critical. Especially for features like Link Time Optimization (LTO), all components should ideally come from the same major and minor CUDA release family to avoid unexpected issues.","severity":"breaking","affected_versions":"CUDA 11.x and later"},{"fix":"Review NVIDIA's CUDA 13 migration guides and release notes when upgrading your CUDA Toolkit version, especially if your project relies on advanced compilation features or custom kernels.","message":"CUDA 13.0 (a successor to CUDA 12.x) introduces significant changes to `nvcc`'s handling of ELF visibility and linkage for `__global__` functions and device variables. These changes can impact separate compilation models and require attention when migrating custom CUDA kernels.","severity":"breaking","affected_versions":"CUDA 13.0 and later (future compatibility)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}