Old Cudnn Version Error On Setup from Source

I’m following the instructions from the Pytorch Github.

When I go for python setup.py install, I get the following error:
Traceback (most recent call last):
File “setup.py”, line 17, in
from tools.setup_helpers.cudnn import WITH_CUDNN, CUDNN_LIB_DIR, CUDNN_INCLUDE_DIR,
File “/home/dpechi01/pytorch/tools/setup_helpers/cudnn.py”, line 104, in
check_cudnn_version(CUDNN_VERSION)
File “/home/dpechi01/pytorch/tools/setup_helpers/cudnn.py”, line 53, in check_cudnn_version
(cudnn_version_string, cudnn_min_version))
RuntimeError: CuDNN v5.1.5 found, but need at least CuDNN v6. You can get the latest version of CuDNN from or disable CuDNN with NO_CUDNN=1

I checked that my conda environment has CuDNN v6, and according to that, I’m on 6.0.21… with cudatoolkit 8.0. I’d assume something’s wrong with my path somewhere, but I’m totally unsure as to how to coordinate those things to get the conda-installed cudnn to be recognized.

Hi there,

I had the same issue here today and looking at the the source code of cudnn.py, it seems to be just looking for the first libcudnn* in the $CUDNN_LIB_DIR and take its version number as your cuDNN version.
In my case I had 2 version of libcudnn.*.dylib, 5 and 7 and I guess it must only looked at the 5 one so the error.
After I deleted the one for version 5, the installation went through.

Hope it helps you as well.

Cheers.

Yes, there was a bug in cudnn.py that would detect your first libcudnn.so as the version. That has been fixed: https://github.com/pytorch/pytorch/issues/3126 so feel free to pull and build from source again.