Fixing TensorFlow libcublas.so.8.0: cannot open shared object file on Ubuntu
Problem:
When you run import tensorflow
in Python, you get one of the following errors:
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory
ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
ImportError: libcufft.so.8.0: cannot open shared object file: No such file or directory
ImportError: libcurand.so.8.0: cannot open shared object file: No such file or directory
Solution
Install the required packages using:
apt-get install libcublas8.0 libcusolver8.0 libcudart8.0 libcufft8.0 libcurand8.0
Note that you also need to install cuDNN - see this followup post
for details on how to do that.
If this method does not work, you can (as a quick workaround) uninstall tensorflow-gpu
and install the tensorflow
- the version without GPU support:
pip3 uninstall tensorflow-gpu
pip3 install tensorflow
However, this will likely make your applications much slower.
For other solutions see the TensorFlow bugtracker on GitHub.