After building TensorFlow from source, seeing libcudart.so and libcudnn errors

后端 未结 12 2540
萌比男神i
萌比男神i 2020-11-28 06:19

I\'m building TensorFlow from source code. The build appears to succeed; however, when my TensorFlow program invokes import tensorflow, one or both of the foll

12条回答
  •  长情又很酷
    2020-11-28 06:49

    I have seen a similar error (bottom of this post), but complaining about libcudnn.so.6 instead of libcudart.so.8.0 (see a note below).

    Solution:

    1. Download 'cuDNN v6.0 Library for Linux':
      • Go to https://developer.nvidia.com/rdp/cudnn-download
      • Click on 'Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0'
      • Then click on 'cuDNN v6.0 Library for Linux'. A file (named 'cudnn-8.0-linux-x64-v6.0.tgz') will be downloaded.
    2. Follow the instructions of Alexander Yau above to install the cuDNN v6.0 library.


    Note:

    the Tensorflow installation instructions (as of 20/Aug/2017) require installing cuDNN v5.1, but my Tensorflow installation (following the instructions for installing in a virtualenv) required cuDNN v6.x (as indicated by the error). I don't know if it is a mistake on my side or a Tensorflow documentation one. Nevertheless, above solution worked for me.


    Encountered error:

    In [1]: import tensorflow as tf
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
     in ()
    ----> 1 import tensorflow as tf
    
    /home/haseeb/.virtualenvs/attention_transformer/local/lib/python2.7/site-packages/tensorflow/__init__.py in ()
         22 
         23 # pylint: disable=wildcard-import
    ---> 24 from tensorflow.python import *
         25 # pylint: enable=wildcard-import
         26 
    
    /home/haseeb/.virtualenvs/attention_transformer/local/lib/python2.7/site-packages/tensorflow/python/__init__.py in ()
         47 import numpy as np
         48 
    ---> 49 from tensorflow.python import pywrap_tensorflow
         50 
         51 # Protocol buffers
    
    /home/haseeb/.virtualenvs/attention_transformer/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py in ()
         50 for some common reasons and solutions.  Include the entire stack trace
         51 above this error message when asking for help.""" % traceback.format_exc()
    ---> 52   raise ImportError(msg)
         53 
         54 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
    
    ImportError: Traceback (most recent call last):
      File "/home/haseeb/.virtualenvs/attention_transformer/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in 
        from tensorflow.python.pywrap_tensorflow_internal import *
      File "/home/haseeb/.virtualenvs/attention_transformer/local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in 
        _pywrap_tensorflow_internal = swig_import_helper()
      File "/home/haseeb/.virtualenvs/attention_transformer/local/lib/python2.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)
    ImportError: libcudnn.so.6: 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.
    

提交回复
热议问题