tensorflow icon indicating copy to clipboard operation
tensorflow copied to clipboard

ImportError: libnvidia-fatbinaryloader.so.375.51: cannot open shared object file

Open StefanoD opened this issue 9 years ago • 58 comments

  • OS: Ubuntu 17.04
  • *TensorFlow installed from: source
  • TensorFlow version: 1.1.0rc1
  • Bazel version (if compiling from source): 0.4.5
  • CUDA/cuDNN version: 8.0/5.1
  • GPU Model and Memory: NVIDIA GTX 1060, 6 GB RAM
  • Exact command to reproduce:
import tensorflow as tf

Describe the problem clearly

I installed Tensorflow from source in order to have all CPU instructions supported.

(tensorflow) stefano@stefano-PC:~$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.5/dist-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/stefano/tensorflow/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/stefano/tensorflow/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libnvidia-fatbinaryloader.so.375.51: 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 "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 51, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python3.5/dist-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/stefano/tensorflow/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/stefano/tensorflow/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libnvidia-fatbinaryloader.so.375.51: 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.
>>> 

My bashrc:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/cuda/lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/nvidia-375
export LIBRARY_PATH=${LIBRARY_PATH}:/usr/local/cuda/lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/nvidia-375

Problem is, that Tensorflow tries to load libnvidia-fatbinaryloader.so.375.51, but it exists only libnvidia-fatbinaryloader.so.375.38. I'm puzzled why TF tries to load a newer version, because right now, version 375.38 is the latest driver available!

StefanoD avatar Apr 08 '17 21:04 StefanoD

~~Remark: I don't have this error with TF 1.0.1~~

StefanoD avatar Apr 09 '17 09:04 StefanoD

Oh, this is not true. It happens in 1.0.1, but TF doesn't abbort.

(tensorflow) stefano@stefano-PC:~$ python3 Python 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118] on linux Type "help", "copyright", "credits" or "license" for more information.

import tensorflow I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:126] Couldn't open CUDA library libcuda.so.1. LD_LIBRARY_PATH: :/usr/local/lib:/usr/local/cuda/lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/nvidia-375 I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:165] hostname: stefano-PC I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] libcuda reported version is: Not found: was unable to find libcuda.so DSO loaded into this program I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:363] driver version file contents: """NVRM version: NVIDIA UNIX x86_64 Kernel Module 375.39 Tue Jan 31 20:47:00 PST 2017 GCC version: gcc version 4.9.4 (Ubuntu 4.9.4-2ubuntu1) """ I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:193] kernel reported version is: 375.39.0 I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1065] LD_LIBRARY_PATH: :/usr/local/lib:/usr/local/cuda/lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/nvidia-375 I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1066] failed to find libcuda.so on this system: Failed precondition: could not dlopen DSO: libcuda.so.1; dlerror: libnvidia-fatbinaryloader.so.375.51: cannot open shared object file: No such file or directory I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally

StefanoD avatar Apr 09 '17 09:04 StefanoD

This happens also, when I install TF via external binaries per pip3.

StefanoD avatar Apr 09 '17 09:04 StefanoD

I have similar issues when installing tensorflow from source. OS: Ubuntu 14.04. bazel: 0.4.5 CUDA: 8.0

`Python 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import tensorflow as tf Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/tensorflow/init.py", line 24, in from tensorflow.python import * File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/init.py", line 51, in from tensorflow.python import pywrap_tensorflow File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in from tensorflow.python.pywrap_tensorflow_internal import * File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) ImportError: libnvidia-fatbinaryloader.so.375.51: 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.

`

Songweiping avatar Apr 09 '17 15:04 Songweiping

This happens when I installed tensorflow via pip.

`Python 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import tensorflow I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:126] Couldn't open CUDA library libcuda.so.1. LD_LIBRARY_PATH: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:165] hostname: dlibgpu I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] libcuda reported version is: Not found: was unable to find libcuda.so DSO loaded into this program I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:363] driver version file contents: """NVRM version: NVIDIA UNIX x86_64 Kernel Module 375.26 Thu Dec 8 18:36:43 PST 2016 GCC version: gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) """ I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:193] kernel reported version is: 375.26.0 I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1065] LD_LIBRARY_PATH: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1066] failed to find libcuda.so on this system: Failed precondition: could not dlopen DSO: libcuda.so.1; dlerror: libnvidia-fatbinaryloader.so.375.51: cannot open shared object file: No such file or directory I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally

`

I have nvidia driver of version: 375.26. However, following facts confused me a lot.

  • find /usr/ -name 'libcuda.so.1' it gives: /usr/lib/i386-linux-gnu/libcuda.so.1 /usr/lib/x86_64-linux-gnu/libcuda.so.1

  • ll /usr/lib/x86_64-linux-gnu/libcuda.so* it gives: lrwxrwxrwx 1 root root 12 Mar 23 00:54 /usr/lib/x86_64-linux-gnu/libcuda.so -> libcuda.so.1 lrwxrwxrwx 1 root root 17 Apr 10 12:23 /usr/lib/x86_64-linux-gnu/libcuda.so.1 -> libcuda.so.375.51 -rw-r--r-- 1 root root 8296456 Mar 23 00:08 /usr/lib/x86_64-linux-gnu/libcuda.so.375.51

  • find /usr/ 'libcuda.so.375.26' gives nothing, means that there is no libcuda.so.375.26 in my system.

  • 'find /usr/ -name '*.375.51'' gives: /usr/lib/libnvidia-gtk2.so.375.51 /usr/lib/i386-linux-gnu/libcuda.so.375.51 /usr/lib/i386-linux-gnu/libnvidia-opencl.so.375.51 /usr/lib/libnvidia-gtk3.so.375.51 /usr/lib/x86_64-linux-gnu/libcuda.so.375.51 /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.375.51 So there is no libnvidia-fatbinaryloader.so.375.51 on my machine.

I want to know why my nvidia driver version is 375.26, but it is libcuda.so.375.51 in my /usr/lib/x86_64-linux-gnu/, instead of libcuda.so.375.26. How can I fix this? Thanks.

Songweiping avatar Apr 10 '17 07:04 Songweiping

I tried to find workaround, but this doesn't work:

sudo ln -s /usr/lib/nvidia-375/libnvidia-fatbinaryloader.so.375.39 /usr/lib/nvidia-375/libnvidia-fatbinaryloader.so.375.51
stefano@stefano-PC:~/Dokumente/Programming/Python/TensorflowCoreTutorial$ /home/stefano/tensorflow/bin/python3 /home/stefano/Dokumente/Programming/Python/TensorflowCoreTutorial/src/mnist_beginners.py
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
Extracting /home/stefano/Dokumente/Programming/Python/MNIST/train-images-idx3-ubyte.gz
Extracting /home/stefano/Dokumente/Programming/Python/MNIST/train-labels-idx1-ubyte.gz
Extracting /home/stefano/Dokumente/Programming/Python/MNIST/t10k-images-idx3-ubyte.gz
Extracting /home/stefano/Dokumente/Programming/Python/MNIST/t10k-labels-idx1-ubyte.gz
E tensorflow/stream_executor/cuda/cuda_driver.cc:509] failed call to cuInit: CUDA_ERROR_NO_DEVICE
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:158] retrieving CUDA diagnostic information for host: stefano-PC
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:165] hostname: stefano-PC
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] libcuda reported version is: 375.51.0
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:363] driver version file contents: """NVRM version: NVIDIA UNIX x86_64 Kernel Module  375.39  Tue Jan 31 20:47:00 PST 2017
GCC version:  gcc version 4.9.4 (Ubuntu 4.9.4-2ubuntu1)
"""
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:193] kernel reported version is: 375.39.0
E tensorflow/stream_executor/cuda/cuda_diagnostics.cc:303] kernel version 375.39.0 does not match DSO version 375.51.0 -- cannot find working devices in this configuration
0.9182

StefanoD avatar Apr 10 '17 16:04 StefanoD

I downgraded to Ubuntu 16.04 and it seems to work. But I only tested TF version 1.0.1. @Songweiping Do you still have the issue?

StefanoD avatar Apr 13 '17 21:04 StefanoD

I'm glad to hear it's working. Our support matrix for Ubuntu Linux only includes versions 14 LTE to 16 LTE. Thank you for bringing the compatibility issues with 17 to the attention of the community.

jart avatar Apr 14 '17 00:04 jart

I think, this shouldn't be taken too lightly, because in august, Ubuntu 16.04.3 will get the Mesa stack and the kernel from 17.04.

StefanoD avatar Apr 14 '17 10:04 StefanoD

I downgraded nvidia driver to 375.26 on my machine and it works for both TF 1.0.1 and TF 1.1.0, the latter was built from source. @StefanoD @jart I suspect that this issue was caused by upgrading bazel tools. When I updated my bazel, it run into an error: E: Failed to fetch http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/./nvidia-375_375.51-0ubuntu1_amd64.deb Size mismatch

The system can not find libcuda.so.375.26, because there is libcuda.so.375.51 in /usr/lib/x86_64-linux-gnu/ instead. When downgrading libcuda.so.375.51 to libcuda.so.375.26, it works well.

Wish this will help.

Songweiping avatar Apr 14 '17 16:04 Songweiping

Please note Nvidia CUDA only lists support for Ubuntu 14.04 and 16.04.

@martinwicke @gunan Users are reporting CUDA issues on Ubuntu 17. Our friend @StefanoD believes these issues will trickle down into 16.04 come August when 16.04.3 is released. Should this issue be reopened?

jart avatar Apr 14 '17 17:04 jart

@jart Actually @Songweiping is using Ubuntu 14.04 as he said in his first post.

StefanoD avatar Apr 14 '17 17:04 StefanoD

Can we do anything about this? We already specify CUDA library paths, do our heuristics need updating to deal with this?

martinwicke avatar Apr 14 '17 17:04 martinwicke

I remember that I couldn't update to NVIDIA 375.51, because of some xorg-video-abi incompatibilities. I'm not sure if Ubuntu 16.04.3 will update to the same xorg version as 17.04.

StefanoD avatar Apr 14 '17 18:04 StefanoD

@meteorcloudy has done work on CUDA heuristics in the past. Perhaps he could take a look into this one?

jart avatar Apr 14 '17 18:04 jart

I'm having the same issues on Ubuntu 16.04.2LTS on a dell xps15 9560 with gtx 1050 4gb. I have the same paths set up as @StefanoD , nvidia-375.51 installed, CUDA-8.0 installed + CUDANN.

Instead I'm running into ImportError: libnvidia-fatbinaryloader.so.381.09: cannot open shared object file: No such file or directory. Why does it ask for 381 and not 375?

LATER EDIT: Symbolic linking fatbinaryloader.so.375.51 to fatbinaryloader.so.381.09 did the trick for me.

colceagus avatar Apr 17 '17 18:04 colceagus

As a workaround, I would recommend to downgrade to nvidia-375.39. This works for me on Ubuntu 16.04.2.

StefanoD avatar Apr 17 '17 19:04 StefanoD

Hi @StefanoD ,

How do i do that ? Could you please guide me ? Also, I compiled tensorflow samples and deviceQuery does not find any cuda-enabled device...

Thanks a bunch, Daniel.

colceagus avatar Apr 17 '17 20:04 colceagus

If you go to the NVIDIA website, you can download the driver version 375.39

http://www.nvidia.de/Download/index.aspx

StefanoD avatar Apr 17 '17 20:04 StefanoD

Just because I'm at the same place at the same time as you guys, I'll comment something non-obvious I found. Many hours were sacrificed for this knowledge.

You might think cuda can either be installed with a .deb file or a .run file. HOWEVER, if you want to use the slightly older 375.39, you need to use the run file. This annoyed me because I think the rule of thumb is not to mix run files and deb files with drivers.

The reason is that the run file will prompt you whether you want to upgrade the driver during installation. Whereas during the procedure: dpkg -i <cuda.deb>&& apt-get update && apt-get install cuda, there is no choice in the matter. Upgrading to 375.51 is forced. You can try to insist not to upgrade the driver with apt-get --nodeps or dpkg --ignore-dep=nvidia-375, but then apt-get will complain of broken dependencies.

I am currently exploring alternatives. My system is ubuntu16.04, 2*TitanX (pascal).

22csnyder avatar Apr 19 '17 03:04 22csnyder