cuDNN version mismatch

Hi, I currently have cuDNN7 installed on my machine. I presumed that I installed PyTorch based on that. When I try to run a piece of code, however, I get the following error:

File "/home/sam/.virtualenvs/cv/lib/python2.7/site-packages/torch/nn/functional.py", line 1011, in affine_grid
    return AffineGridGenerator.apply(theta, size)
  File "/home/sam/.virtualenvs/cv/lib/python2.7/site-packages/torch/nn/_functions/vision.py", line 75, in forward
    AffineGridGenerator._enforce_cudnn(theta)
  File "/home/sam/.virtualenvs/cv/lib/python2.7/site-packages/torch/nn/_functions/vision.py", line 66, in _enforce_cudnn
    assert cudnn.is_acceptable(input)
  File "/home/sam/.virtualenvs/cv/lib/python2.7/site-packages/torch/backends/cudnn/__init__.py", line 49, in is_acceptable
    if _libcudnn() is None:
  File "/home/sam/.virtualenvs/cv/lib/python2.7/site-packages/torch/backends/cudnn/__init__.py", line 25, in _libcudnn
    'but linked against {}'.format(compile_version, __cudnn_version))
RuntimeError: cuDNN version mismatch: PyTorch was compiled against 6021 but linked against 7001

It does sound like it needs cuDNN6, but isn’t there any option that I could use PyTorch together with cuDNN7?

1 Like

you could remove the path to cuDNN7 from your $LD_LIBRARY_PATH

2 Likes

Thanks, it worked. Much appreciated!

@smth @smtak
"RuntimeError: cuDNN version mismatch: PyTorch was compiled against 6021 but linked against 5110"

In my case this is the error message i get. What should i do?
How to remove the path to cuDNN7 from your $LD_LIBRARY_PATH?

It sounds like you have cudnn 5 installed. If you’re sure you have cudnn6 on your system:

In a terminal:

echo $LD_LIBRARY_PATH
# should print something like /public/apps/NCCL/2.0.5/lib:/public/apps/cudnn/v6.0/cuda/lib64:/public/apps/cuda/8.0/lib64
export $LD_LIBRARY_PATH=<the string above but without the cudnn5 path>

@richard

under /usr/local/cuda/lib64 I do have libcudnn.so.5 and libcudnn.so.6.
Then I type cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2 in shell, and it did print out my current cudnn version is 6021.

Moreover, I remove export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} from .bashrc, and replace it with export LD_LIBRARY_PATH=/home/adnan/ML_packages/cudnn6/cuda/lib64. Not working.

I am suffering the same problem, have you solved it?

Hello I have the same problem, but my system is windows 7 64 bit, CUDA 8, anaconda, python 3.6, with pytorch 0.4.0.
RuntimeError: cuDNN version mismatch: PyTorch was compiled against 7005 but linked against 6021
How to solve the same problem in windows?
Thanks