cuda
build_error
ai_generated
true
RuntimeError: NVRTC compilation failed: error: cannot open source file 'cuda_runtime.h'
ID: cuda/nvrtc-include-path-missing
90%Fix Rate
87%Confidence
1Evidence
2023-09-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| CUDA 11.8 | active | — | — | — |
| CUDA 12.0 | active | — | — | — |
| PyTorch 2.1 | active | — | — | — |
| TensorFlow 2.13 | active | — | — | — |
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.
generic中文
NVRTC(CUDA 运行时编译)找不到 CUDA 包含路径,因为 CUDA 工具包头文件不在默认搜索路径中,或者 CUDA_HOME 环境变量未正确设置。
Official Documentation
https://docs.nvidia.com/cuda/nvrtc/index.htmlWorkarounds
-
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.
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.
-
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.
Create a symlink from the CUDA toolkit include directory to a standard location, or add it to the CPLUS_INCLUDE_PATH environment variable.
中文步骤
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.
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
Common approaches that don't work:
-
90% fail
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.
-
70% fail
This may work temporarily but breaks portability and version compatibility; also other headers may be missing.