QBoard » Artificial Intelligence & ML » AI and ML - Tensorflow » Tensorflow (in R) cannot find libcudart.so.11.0

Tensorflow (in R) cannot find libcudart.so.11.0

  • I've spent an entire day on StackOverflow and the Tensorflow Github issues page trying to fix this, but still can't seem to resolve the problem, suggesting there's something obvious I'm missing.

    I'm trying to get Tensorflow with GPU support running within RStudio on Ubuntu LTS 20.04. I've followed the RStudio installation instructions with Nvidia drivers 470, CUDA 11.2, and cuDDN 8.1.0, updated ~/.bashrc to point at

    export CUDA_HOME=/usr/local/cuda
    export PATH="/usr/local/cuda/bin:$PATH"
    export LD_LIBRARY_PATH=/usr/lib/cuda/lib64:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH=/usr/lib/cuda/include:$LD_LIBRARY_PATH​

    and installed TF with GPU support via install_keras(tensorflow = "gpu"), yet still getting the dreaded error:

    W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/nickopotamus/.local/share/r-miniconda/envs/r-reticulate/lib:/usr/lib/R/lib::/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server
    ​


    sudo find / -name 'libcudart.so.11.0' finds the file in:


    /home/nickopotamus/.local/share/r-miniconda/envs/r-reticulate/lib/libcudart.so.11.0
    /home/nickopotamus/anaconda3/pkgs/cudatoolkit-11.3.1-h2bc3f7f_2/lib/libcudart.so.11.0
    /home/nickopotamus/anaconda3/pkgs/cudatoolkit-11.2.0-h73cb219_8/lib/libcudart.so.11.0
    /home/nickopotamus/anaconda3/pkgs/cudatoolkit-11.2.72-h2bc3f7f_0/lib/libcudart.so.11.0
    /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudart.so.11.0​


    The top entry at least appears to be in the path that the error is searching, so I'm at a bit of a loss as to what to try next. Is it a conflict with the other anaconda packages (which I can't seem to remove), or am I simply being oblivious to a quick-fix?

    Edit: Solved by using the NVIDIA Data Science Stack to install everything from scratch.

      December 27, 2021 1:51 PM IST
    0
  • Not a particularly satisfying answer, but solved by removing all NVIDIA packages and installing the NVIDIA Data Science Stack from scratch, then using its Conda environment to run kerass in R.

     
      December 28, 2021 12:34 PM IST
    0
  • It seems that you have cuda 10 installed, and not version 11 which is what TensorFlow is looking for. It has rather specific requirements to get working.

    Tensorflow 2.4.1 requires cuda 11 and cudnn 8 (see GPU table of requirements here). I would suggest checking also, your nvidia driver version, 450.x or higher is required.

    This is the TensorFlow official documentations on how to get all requirements installed for GPU training/inference, look under which OS you are running.

    If you just wanted to update cuda via conda, you could do a 

    conda install cudatoolkit=11.0.
      January 6, 2022 1:15 PM IST
    0