0

I am trying to use GPU with Tensorflow, so I installed CUDA 10.1, CUNN 7.6, TensorRT 6, and Tensorflow-GPU 2.1.0. But when I import tensorflow to check if it can detect the gpu. it gives me the following error

>>> import tensorflow as tf
2020-04-22 14:44:14.473830: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/usr/local/cuda/lib64:/usr/local/cuda/lib64:/usr/local/cuda-10.1/lib64
2020-04-22 14:44:14.473880: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64:/usr/local/cuda/lib64:/usr/local/cuda/lib64:/usr/local/cuda-10.1/lib64
2020-04-22 14:44:14.473887: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.

Can you tell me how can I get the missing libraries please?

Thank you Hadeel

  • You have totally messed up your PATH and LD_LIBRARY_PATH. All the system areas are missing in PATH, and you have multiple copies of the CUDA bin and lib64. – ubfan1 Apr 22 at 16:01
0

This works in Ubuntu 19.10 (and likely other versions):

WARNING: This might hose your NVIDIA graphics driver so back steps to boot via backup disk, ZFS snapshot, or whatever. You have been warned.

I was able to boot into a graphical version, but OpenGL was broken. Directions on how I restored this are below.

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1810/x86_64/cuda-repo-ubuntu1810_10.1.168-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1810_10.1.168-1_amd64.deb
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1810/x86_64/7fa2af80.pub
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt update
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo dpkg -i nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt update

sudo apt-get install --no-install-recommends \
    cuda-10-1 \
    libcudnn7=7.6.4.38-1+cuda10.1  \
    libcudnn7-dev=7.6.4.38-1+cuda10.1

    # Install TensorRT. Requires that libcudnn7 is installed above.
sudo apt-get install -y --no-install-recommends  
    libnvinfer6=6.0.1-1+cuda10.1 \
    libnvinfer-dev=6.0.1-1+cuda10.1 \
    libnvinfer-plugin6=6.0.1-1+cuda10.1

As I said above, I had to reinstall my NVIDIA graphics card drives:

sudo add-apt-repository ppa:graphics-drivers
sudo apt update
sudo apt -u dist-upgrade

Then reboot and try both importing tensorflow as well as running an OpenGL application. Both should work if things went well.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.