エラー「ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory」

問題点

$ python
>>> import tensorflow as tf
Traceback (most recent call last):
  File "/home/saneatsu_wakana/PConv-Keras/venv/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/saneatsu_wakana/PConv-Keras/venv/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/saneatsu_wakana/PConv-Keras/venv/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/usr/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

原因、解決策

どうやらCUDAやtensorflowのバージョンの関係で起こる問題のようだ。

CUDAのVersion: 10.0、tensorflow==1.8.0 だと問題が起こる。

$ pip uninstall tensorflow
$ pip install tensorflow==1.9.0

$ python3 -c 'import tensorflow as tf; print(tf.__version__)'
1.9.0

バージョンが出るということはimport出来ているということなので無事解決。

他の解決方法としてはCUDA側のバージョンを操作する方法もある。 qiita.com