ImportError: libcudnn when running a TensorFlow program

前端 未结 8 1804
名媛妹妹
名媛妹妹 2020-12-03 07:03

I encountered the following error when trying to run a TensorFlow program:

ImportError: libcudnn.Version: cannot open shared object file: No such file or d         


        
相关标签:
8条回答
  • 2020-12-03 07:25

    Make sure the $LD_LIBRARY_PATH environment variable is set to the correct path.

    From the cuDNN Install Guide:

    ALL PLATFORMS

    Extract the cuDNN archive to a directory of your choice, referred to below as <installpath>.
    Then follow the platform-specific instructions as follows.
    

    LINUX

    cd <installpath>
    export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
    
    Add <installpath> to your build and link process by adding -I<installpath> to your compile
    line and -L<installpath> -lcudnn to your link line.
    

    OS X

    cd <installpath>
    export DYLD_LIBRARY_PATH=`pwd`:$DYLD_LIBRARY_PATH
    
    Add <installpath> to your build and link process by adding -I<installpath> to your compile
    line and -L<installpath> -lcudnn to your link line.
    

    WINDOWS

    Add <installpath> to the PATH environment variable.
    
    In your Visual Studio project properties, add <installpath> to the Include Directories 
    and Library Directories lists and add cudnn.lib to Linker->Input->Additional Dependencies.
    
    0 讨论(0)
  • 2020-12-03 07:29

    Just download cuDNN 5.1 and follow the steps (Tested on Ubuntu 16.04, CUDA toolkit 8.0 )

    $ tar xvzf cudnn-8.0-linux-x64-v5.1-ga.tgz
    $ sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include
    $ sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
    $ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
    

    Now set Path variables

    $ vim ~/.bashrc
    
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
    export CUDA_HOME=/usr/local/cuda
    

    and done

    For more details, you can check this site

    0 讨论(0)
  • 2020-12-03 07:30

    At this time Tensorflow does not support cuDNN 6. If your error is that it cannot find libcudnn.so.5 and you have only installed cuDNN 6 which provides libcudnn.so.6, you'll have to install cuDNN 5 until cuDNN 6 support is introduced. There's an open bug report that you can follow on the Tensorflow Github page to find out when they start supporting cuDNN 6.

    0 讨论(0)
  • 2020-12-03 07:39

    Download and install cuDNN from https://developer.nvidia.com/rdp/cudnn-download

    for ubuntu 18.04 and cuda 10.1:

    sudo dpkg -i libcudnn7_7.5.0.56-1+cuda10.1_amd64.deb
    
    0 讨论(0)
  • 2020-12-03 07:40

    I faced this issue. In my case my eclipse gave this error but tensorflow was running smoothly in terminal. So after cuDNN installation or pasting the files related to cudNN in /usr/local/cuda/lib64 and /usr/local/cuda/include, I figured that the command sudo ldconfig -v also has to be executed in the terminal.

    After that it should work.

    This is assuming that one has already set the following environment variables as per the specifications in CUDA installation procedure by NVIDIA: LD_LIBRARY_PATH, PATH, CUDA_HOME

    0 讨论(0)
  • 2020-12-03 07:48

    You may not have installed the correct version of cuDNN.

    To determine the correct version of cuDNN, see the NVIDIA requirements to run TensorFlow with GPU support.

    0 讨论(0)
提交回复
热议问题