tensorflow: Auto-Configuration Error: Cannot find cudnn.h at /usr/lib/x86_64-linux-gnu/include/cudnn.h

What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?

#4397, but it’s for 16.04

Environment info

Operating System: Ubuntu 14.04 Installed version of CUDA and cuDNN: 8.0, 5.1 (please attach the output of ls -l /path/to/cuda/lib/libcud*):

ls -l /path/to/cuda/lib/libcud*
-rw-r--r-- 1 root 543K Jan 26 15:48 /usr/local/cuda/lib64/libcudadevrt.a
lrwxrwxrwx 1 root   16 Jan 26 15:51 /usr/local/cuda/lib64/libcudart.so -> libcudart.so.8.0
lrwxrwxrwx 1 root   19 Jan 26 15:51 /usr/local/cuda/lib64/libcudart.so.8.0 -> libcudart.so.8.0.61
-rw-r--r-- 1 root 406K Jan 26 15:48 /usr/local/cuda/lib64/libcudart.so.8.0.61
-rw-r--r-- 1 root 757K Jan 26 15:48 /usr/local/cuda/lib64/libcudart_static.a
ll /usr/lib/x86_64-linux-gnu/libcudnn*                                                                                                                                                                
lrwxrwxrwx 1 root  29 Mar  1 11:58 /usr/lib/x86_64-linux-gnu/libcudnn.so -> /etc/alternatives/libcudnn_so
lrwxrwxrwx 1 root  18 Nov  6 23:19 /usr/lib/x86_64-linux-gnu/libcudnn.so.5 -> libcudnn.so.5.1.10
-rw-r--r-- 1 root 81M Nov  6 23:19 /usr/lib/x86_64-linux-gnu/libcudnn.so.5.1.10
lrwxrwxrwx 1 root  32 Mar  1 11:58 /usr/lib/x86_64-linux-gnu/libcudnn_static.a -> /etc/alternatives/libcudnn_stlib
-rw-r--r-- 1 root 68M Nov  6 23:19 /usr/lib/x86_64-linux-gnu/libcudnn_static_v5.a

If installed from source, provide

  1. The commit hash (git rev-parse HEAD): e895d5ca395c2362df4f5c8f08b68501b41f8a98
  2. The output of bazel version:
INFO: Reading 'startup' options from /root/.bazelrc: --batch
Build label: 0.4.2
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Dec 7 18:47:11 2016 (1481136431)
Build timestamp: 1481136431
Build timestamp as int: 1481136431

If possible, provide a minimal reproducible example (We usually don’t have time to read hundreds of lines of your code)

I ran

./configure

It failed with

INFO: Reading 'startup' options from /root/.bazelrc: --batch
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
INFO: Reading 'startup' options from /root/.bazelrc: --batch
ERROR: package contains errors: tensorflow/compiler/tests.
ERROR: error loading package 'tensorflow/compiler/tests': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):
        File "/tensorflow/third_party/gpus/cuda_configure.bzl", line 816
                _create_cuda_repository(repository_ctx)
        File "/tensorflow/third_party/gpus/cuda_configure.bzl", line 729, in _create_cuda_repository
                _get_cuda_config(repository_ctx)
        File "/tensorflow/third_party/gpus/cuda_configure.bzl", line 585, in _get_cuda_config
                _cudnn_version(repository_ctx, cudnn_install_base..., ...)
        File "/tensorflow/third_party/gpus/cuda_configure.bzl", line 296, in _cudnn_version
                _find_cuda_define(repository_ctx, cudnn_install_base..., ...)
        File "/tensorflow/third_party/gpus/cuda_configure.bzl", line 271, in _find_cuda_define
                auto_configure_fail("Cannot find cudnn.h at %s" % st...))
        File "/tensorflow/third_party/gpus/cuda_configure.bzl", line 93, in auto_configure_fail
                fail("
%sAuto-Configuration Error:%s ...))

Auto-Configuration Error: Cannot find cudnn.h at /usr/lib/x86_64-linux-gnu/include/cudnn.h

I noticed the cudnn.h is in /usr/include/cudnn.h somehow, while its libs are in /usr/lib/x86_64-linux-gnu/.

I read cuda_configure.bzl, but didn’t find an easy way to let it find both cudnn headers and libs.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 23 (15 by maintainers)

Most upvoted comments

I think this happens when cudnn is installed using the deb package. @byzhang could you confirm how you installed cudnn?

The main reason is cuda version information is not stored in cudnn.h anymore in CUDA 11.X. In CUDA 11.X, the version information seems to stored in new cudnn_version.h file. So many build tools such as cmake depends on cudnn.h for CUDA version information cannot guess CUDA version anymore.

/usr/include/cudnn.h is indeed a symlink, but that’s for allowing users to switch cuDNN versions on the same machine through Debian alternatives:

/usr/include/cudnn.h -> /etc/alternatives/libcudnn -> /usr/include/x86_64-linux-gnu/cudnn_v5.h

cuDNN v4 was different though, the actual header was at /usr/include/cudnn_v4.h