cudaErrorDriverLibraryNotLoaded cuda system_error ai_generated true

CUDA 错误:驱动程序库未加载 (cudaErrorDriverLibraryNotLoaded)

CUDA error: driver library is not loaded (cudaErrorDriverLibraryNotLoaded)

ID: cuda/driver-library-not-loaded

其他格式: JSON · Markdown 中文 · English
82%修复率
87%置信度
1证据数
2023-11-01首次发现

版本兼容性

版本状态引入弃用备注
CUDA 11.8 active
CUDA 12.2 active
CUDA 12.4 active

根因分析

CUDA 驱动程序共享库 (libcuda.so) 未找到或无法加载,通常是因为未安装 NVIDIA 驱动程序或缺少库路径。

English

The CUDA driver shared library (libcuda.so) is not found or cannot be loaded, usually because the NVIDIA driver is not installed or the library path is missing.

generic

官方文档

https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__DRIVER.html

解决方案

  1. Install the NVIDIA driver matching your GPU and CUDA version. For Ubuntu 22.04 with CUDA 12.2: sudo apt update; sudo apt install nvidia-driver-535; sudo reboot. Verify with 'nvidia-smi' and 'ldconfig -p | grep libcuda'.
  2. If the driver is installed but libcuda.so is not in the linker path, add it explicitly: sudo ldconfig /usr/lib/x86_64-linux-gnu/nvidia/current; or set LD_LIBRARY_PATH to that directory: export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/nvidia/current:$LD_LIBRARY_PATH.

无效尝试

常见但无效的做法:

  1. 80% 失败

    Installing the CUDA toolkit without the NVIDIA driver is insufficient; the driver provides libcuda.so.

  2. 70% 失败

    Setting LD_LIBRARY_PATH to a wrong directory (e.g., /usr/local/cuda/lib instead of lib64) does not help and may break other libraries.