# RuntimeError: NVRTC compilation failed: error: cannot open source file 'cuda_runtime.h'

- **ID:** `cuda/nvrtc-include-path-missing`
- **Domain:** cuda
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

NVRTC (CUDA runtime compilation) cannot find the CUDA include path because the CUDA toolkit headers are not in the default search path or the CUDA_HOME environment variable is not set correctly.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| CUDA 11.8 | active | — | — |
| CUDA 12.0 | active | — | — |
| PyTorch 2.1 | active | — | — |
| TensorFlow 2.13 | active | — | — |

## Workarounds

1. **Set the CUDA_HOME environment variable to the root of your CUDA installation (e.g., /usr/local/cuda-12.1) before running the script. For Python, add it in the code using os.environ.** (90% success)
   ```
   Set the CUDA_HOME environment variable to the root of your CUDA installation (e.g., /usr/local/cuda-12.1) before running the script. For Python, add it in the code using os.environ.
   ```
2. **Create a symlink from the CUDA toolkit include directory to a standard location, or add it to the CPLUS_INCLUDE_PATH environment variable.** (85% success)
   ```
   Create a symlink from the CUDA toolkit include directory to a standard location, or add it to the CPLUS_INCLUDE_PATH environment variable.
   ```

## Dead Ends

- **** — NVRTC relies on the system's CUDA installation, not the deep learning framework's bundled headers; reinstalling the framework does not fix the include path. (90% fail)
- **** — This may work temporarily but breaks portability and version compatibility; also other headers may be missing. (70% fail)
