0

I am trying to work with tensorflow-gpu==1.2.0 in google-colab. I did install the package, cuda-8.0 and download and move libcudnn.so.5 into /usr/local/cuda/lib64 and still I get this error:

ImportError: Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 29, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 25, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory

I tried to follow the next solution: ImportError: libcudnn when running a TensorFlow program But it does not work for me. I would be happy to get some help.

talonmies
  • 70,661
  • 34
  • 192
  • 269
Daniel Nudelman
  • 401
  • 5
  • 11

1 Answers1

1

If the file cannot be found, it's not in a place the linker is looking.

From the ld man page:

The linker uses the following search paths to locate required shared libraries:

  1. Any directories specified by -rpath-link options.
  2. Any directories specified by -rpath options. The difference between -rpath and -rpath-link is that directories specified by -rpath options are included in the executable and used at runtime, whereas the -rpath-link option is only effective at link time. Searching -rpath in this way is only supported by native linkers and cross linkers which have been configured with the --with-sysroot option.
  3. On an ELF system, for native linkers, if the -rpath and -rpath-link options were not used, search the contents of the environment variable "LD_RUN_PATH".
  4. On SunOS, if the -rpath option was not used, search any directories specified using -L options.
  5. For a native linker, the search the contents of the environment variable "LD_LIBRARY_PATH".
  6. For a native ELF linker, the directories in "DT_RUNPATH" or "DT_RPATH" of a shared library are searched for shared libraries needed by it. The "DT_RPATH" entries are ignored if "DT_RUNPATH" entries exist.
  7. The default directories, normally /lib and /usr/lib.
  8. For a native linker on an ELF system, if the file /etc/ld.so.conf exists, the list of directories found in that file.

If the required shared library is not found, the linker will issue a warning and continue with the link.

Also see ldconfig man page:

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib). The cache is used by the run-time linker, ld.so or ld-linux.so. ldconfig checks the header and filenames of the libraries it encounters when determining which versions should have their links updated.

...

Options

-v

Verbose mode. Print current version number, the name of each directory as it is scanned, and any links that are created. Overrides quiet mode.

Doug Richardson
  • 10,483
  • 6
  • 51
  • 77
  • Thank you! Based on your answer I did add the libcudnn5 files to the /lib and create a soft link to libcudnn.so.5 in the /lib directory and it did resolve the problem. – Daniel Nudelman Sep 07 '19 at 12:48