Hitesh
Hitesh

Reputation: 1325

After installing Tensorflow-gpu i got error Failed to load the native TensorFlow runtime

I have installed redhat 6.6, cuda 9.0, cudnn 7.3.1 and tesnorflow-gpu. but after installation getting following error. My graphics card is nvidia titan v Traceback (most recent call last):

  File "<ipython-input-1-88d96843a926>", line 1, in <module>
    import keras

  File "/root/anaconda3/lib/python3.7/site-packages/keras/__init__.py", line 3, in <module>
    from . import utils

  File "/root/anaconda3/lib/python3.7/site-packages/keras/utils/__init__.py", line 6, in <module>
    from . import conv_utils

  File "/root/anaconda3/lib/python3.7/site-packages/keras/utils/conv_utils.py", line 9, in <module>
    from .. import backend as K

  File "/root/anaconda3/lib/python3.7/site-packages/keras/backend/__init__.py", line 89, in <module>
    from .tensorflow_backend import *

  File "/root/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf

  File "/root/anaconda3/lib/python3.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import

  File "/root/anaconda3/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow

  File "/root/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)

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

Upvotes: 0

Views: 300

Answers (1)

Baptiste Pouthier
Baptiste Pouthier

Reputation: 572

Did you tested your installations of cuda and cudnn:

Nvidia drivers:

$ nvidia-smi

This should display you an overview of the metrics of your GPU

Test cuda:

Check first if:

$ nvcc -V

display the right version of your cuda toolkit

Then you can test it with the following process: First:

 $ cd ~/NVIDIA_CUDA-9.0_Samples
 $ make

And then:

$ cd ~/NVIDIA_CUDA-10.0_Samples/bin/x86_64/linux/release
$./deviceQuery

if you have a 'Result: pass' at the end, you're all good!

To test cudnn:

$ cp -r /usr/src/cudnn_samples_v7/ $HOME
$ cd $HOME/cudnn_samples_v7/mnistCUDNN
$ make clean && make
$ ./mnistCUDNN

You should have as result: 'Test passed!'

Tensorflow:

If cuda and cudnn are working, i advice you to install tensorflow in a conda environment using:

conda create --name tf_gpu tensorflow-gpu

For me (and after a lot of problems) it was working very well.

To test it:

from tensorflow.python.client import device_lib
device_lib.list_local_devices()

main sources: install tensorflow GPU tensorflow for GPU made easy

Upvotes: 1

Related Questions