I have recently installed tensorflow-gpu using pip. But when I am importing it it is giving the following error:
ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory
I have gone through all the answers of stackoverflow related to this issue but none of them worked for me.
libcudnn.so.7 is present in both the following directories /usr/local/cuda/lib64 and /usr/local/cuda-9.0/lib64 .
Also, I have added the following path in my .bashrc file:
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Please help me in resolving this
The reason is that some libraries are missing. Try installing
Reinstalling CudNN-7.0.5, (make sure you pick the right version from the link below) fixed this for me. You'll need to log in to your Nvidia developer account to access the link. (If you don't have an Nvidia account, creating one is straight forward);
https://developer.nvidia.com/rdp/cudnn-archive
Installation instructions for CudNN; https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html
But I also encountered the following error;
Loaded runtime CuDNN library: 7.0.5 but source was compiled with: 7.4.2. CuDNN library major and minor version needs to match or have higher minor version in case of CuDNN 7.0 or later version. If using a binary install, upgrade your CuDNN library. If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.
Therefore, I had to once again download and install the right CuDNN version, i used the information from the above error message and installed CuDNN 7.4.2 and this fixed all the errors and everything worked fine.
Good Luck!
FWIW is interested I created a shell script which installs different CUDA versions in Debian which can be easily ported to Ubuntu:
You are setting LD_LIBRARY_PATH in the wrong way, I would recommend to do it this way (which is kind of the standard):
you add the following path in your .bashrc file: