2
votes

I am trying to install tensorflow in Ubuntu 18.04. CUDA and cudnn tests all pass. The title of this question is my error when testing the tensorflow installation. I saw the same question asked for Ubuntu 16.04, but the answers were not immediately helpful. One answer suggested the use of strace, but I do not understand the output.

Here is my full error message:

Traceback (most recent call last): File "/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "/home/dma/tensorflow/lib/python3.6/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 "/home/dma/tensorflow/lib/python3.6/imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "/home/dma/tensorflow/lib/python3.6/imp.py", line 343, in load_dynamic return _load(spec) ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/init.py", line 22, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/init.py", line 49, in from tensorflow.python import pywrap_tensorflow File "/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "/home/dma/tensorflow/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "/home/dma/tensorflow/lib/python3.6/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 "/home/dma/tensorflow/lib/python3.6/imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "/home/dma/tensorflow/lib/python3.6/imp.py", line 343, in load_dynamic return _load(spec) ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.

2
Where is libcublas.so.9.0 and is that folder in your PATH?Dr. Snoopy
libcublas.so.9.0 is in my LD_LIBRARY_PATH. In the end, I just rolled back to Ubuntu 16.04 and all is well. I am not certain, but my interpretation is that Tensorflow is not yet fully integrated with Ubuntu 18.04user3877654
That's not really an answer, its probably something you didn't consider or a small mistake.Dr. Snoopy

2 Answers

2
votes

append:

export  PATH=/usr/local/cuda/bin:$PATH
export  LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH 

to /etc/profile

then, reboot.

If you dont have softlink cuda linked with cuda-9.0 in /usr/local, just create one softlink at first or modify the above path to what you have.

0
votes

Using a virtual environment to isolate package installation from the system, as it is recommendend in the tensorflow installation guide, fixed it for me.

https://www.tensorflow.org/install/pip