解决TensorFlow:ImportError: libcudnn.so.*: cannot open shared object file: No such file or dictionary
环境
Ubuntu16.04
Nvidia 384
CUDA 8.0
cuDNN 5
错误
TensorFlow、CUDA、cuDNN的版本关系我时常懵懵的,经常出现各种不支持的情况,比如今天安装了TensorFlow1.10.1,报错:ImportError: libcudnn.so.7: cannot open shared object file: No such file or dictionary
错误缘由
google了一圈发现, 问题出在 TensorFlow 1.10.1-gpu
是基于cuDNN7
,需要的也就是libcudnn.so.7
了。
解决方案:
Just download cuDNN v6 and follow the steps (Tested on Ubuntu 16.04, CUDA toolkit 9.0 ) https://developer.nvidia.com/cudnn
Download cuDNN v7.2.1 (August 7, 2018), for CUDA 9.2
cuDNN v7.2.1 Library for Linux
cuDNN v7.2.1 Library for Linux (Power8/Power9)
cuDNN v7.2.1 Library for Windows 7
cuDNN v7.2.1 Library for Windows 10
cuDNN v7.2.1 Runtime Library for Ubuntu16.04 (Deb)
cuDNN v7.2.1 Developer Library for Ubuntu16.04 (Deb)
cuDNN v7.2.1 Code Samples and User Guide for Ubuntu16.04 (Deb)
cuDNN v7.2.1 Runtime Library for Ubuntu16.04 & Power8 (Deb)
cuDNN v7.2.1 Developer Library for Ubuntu16.04 & Power8 (Deb)
cuDNN v7.2.1 Code Samples and User Guide for Ubuntu16.04 & Power8 (Deb)
cuDNN v7.2.1 Runtime Library for Ubuntu14.04 (Deb)
cuDNN v7.2.1 Developer Library for Ubuntu14.04 (Deb)
cuDNN v7.2.1 Code Samples and User Guide for Ubuntu14.04 (Deb)
Download cuDNN v7.2.1 (August 7, 2018), for CUDA 9.0
cuDNN v7.2.1 Library for Linux
cuDNN v7.2.1 Library for Linux (Power8)
cuDNN v7.2.1 Library for Windows 7
cuDNN v7.2.1 Library for Windows 10
cuDNN v7.2.1 Runtime Library for Ubuntu16.04 (Deb)
cuDNN v7.2.1 Developer Library for Ubuntu16.04 (Deb)
cuDNN v7.2.1 Code Samples and User Guide for Ubuntu16.04 (Deb)
cuDNN v7.2.1 Runtime Library for Ubuntu16.04 & Power8 (Deb)
cuDNN v7.2.1Developer Library for Ubuntu16.04 & Power8 (Deb)
cuDNN v7.2.1 Code Samples and User Guide for Ubuntu16.04 & Power8 (Deb)
cuDNN v7.2.1 Runtime Library for Ubuntu14.04 (Deb)
cuDNN v7.2.1 Developer Library for Ubuntu14.04 (Deb)
cuDNN v7.2.1 Code Samples and User Guide for Ubuntu14.04 (Deb)
Download cuDNN v7.2.1 (August 7, 2018), for CUDA 8.0
cuDNN v7.2.1 Library for Linux
cuDNN v7.2.1 Library for Windows 7
cuDNN v7.2.1 Library for Windows 10
cuDNN v7.2.1 Runtime Library for Ubuntu16.04 (Deb)
cuDNN v7.2.1 Developer Library for Ubuntu16.04 (Deb)
cuDNN v7.2.1 Code Samples and User Guide for Ubuntu16.04 (Deb)
cuDNN v7.2.1 Runtime Library for Ubuntu14.04 (Deb)
cuDNN v7.2.1 Developer Library for Ubuntu14.04 (Deb)
cuDNN v7.2.1 Code Samples and User Guide for Ubuntu14.04 (Deb)
$ tar xvzf cudnn-8.0-linux-x64-v5.1-ga.tgz
$ sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
Now set Path variables
$ vim ~/.bashrc
翻到最底部加上:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda