I am trying to install tensorflow with cuda and gpu support. When I try to import it, I get the following error:
Traceback (most recent call last):
File \"
I had cuda-9.0
installed and the LD_LIBRARY_PATH
was pointing to the correct location. Turned out that the permission of the folder /usr/local/cuda-9.0
was wrong. I could not even cd
to the folder. I changed the owner of the cuda-9.0
from root
to my-user-name
and after that python was able to find the missing library.
This is almost always a missing path in your LD_LIBRARY_PATH
. Find libcublas.so.9.0
on your system (start looking under /usr/local
).
If you don't find it, then install the CUDA 9.0 Toolkit (note that with TF 1.5 you want 9.0 and not 9.1, a common gotcha, at least common in-so-far as I made that mistake myself).
https://developer.nvidia.com/cuda-90-download-archive
If you have it, then update your LD_LIBRARY_PATH
to point to the appropriate lib
directory.
If you've done either of those and are now getting a similar looking error for a cudnn related library, then repeat that process for the CUDNN library.
https://developer.nvidia.com/cudnn
I think the latest version works. Tensorflow depends on both CUDA toolkit and the CuDNN library extension.
Note that you can install all of this in userspace too (sudo is typical, but not required).
To easily find the libcublas
file, run sudo find / -iname 'libcublas*'
. Then add the path to the folder containing that file into LD_LIBRARY_PATH
.