pytorch build_error ai_generated true

RuntimeError: cuDNN 版本不匹配:PyTorch 编译时使用 cuDNN X,但链接时使用 cuDNN Y

RuntimeError: cuDNN version mismatch: PyTorch was compiled against cuDNN X but linked against cuDNN Y

ID: pytorch/cudnn-version-mismatch

其他格式: JSON · Markdown 中文 · English
85%修复率
88%置信度
1证据数
2023-06-20首次发现

版本兼容性

版本状态引入弃用备注
1.12 active
1.13 active
2.0 active
2.1 active
2.2 active
2.3 active

根因分析

安装的 PyTorch 二进制文件编译时使用的 cuDNN 版本与系统或环境中安装的 cuDNN 版本不匹配。

English

Installed PyTorch binary was compiled with a different cuDNN version than the one installed on the system or in the environment.

generic

官方文档

https://pytorch.org/get-started/locally/

解决方案

  1. Install PyTorch with the matching cuDNN version using conda or pip from pytorch.org, ensuring the cudatoolkit package matches. For example: conda install pytorch torchvision torchaudio cudatoolkit=11.8 -c pytorch
  2. Use a Docker container from PyTorch's official images to avoid system-level cuDNN conflicts.

无效尝试

常见但无效的做法:

  1. 60% 失败

    This only changes the visible version but doesn't fix the underlying library path.

  2. 50% 失败

    This may break other CUDA-dependent libraries that need the system cuDNN.