Could not load dynamic library 'libnvinfer.so.7'

Hi. I have tried every thing I found on the internet for 2 days, installing, uninstalling, rebooting, but I am stuck with this message when importing tensorflow in python 3.9:

2022-10-22 14:18:13.735020: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-10-22 14:18:14.196931: E tensorflow/stream_executor/cuda/cuda_blas.cc:2981] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2022-10-22 14:18:15.108880: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘libnvinfer.so.7’; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory
2022-10-22 14:18:15.108960: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘libnvinfer_plugin.so.7’; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory
2022-10-22 14:18:15.108968: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: 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.

I am on ubuntu2204, with a MX150 nvidia GPU. I’ve installed cuda 11.8, toolkit 11.8, cudnn 8.6, tensorrt 8.

What can I do please?

1 Like

Hi,

I am having the same issue. Did you find any solution? I tried to install libnvinfer related packages. But they can’t be located.

2 Likes

Exact same issue here with Ubuntu 22.04, different graphics board. Can’t get anything to use GPU. Tried at least a dozen recommendations on various threads.

1 Like

Hi, first install TensorRT (download here), then copy file libnvinfer_plugin.so.8 or libnvinfer_plugin.so which in the TensorRT lib path to libnvinfer_plugin.so.7, it works good for me.

1 Like

Could you tell me where libnvinfer_plugin.so.8 is?

I mostlmy have the same issue.
Is it possible to get some support ?

@tingbopku you may be able to use the workaround posted by another user. Create a symbolic link to the (incorrect) version library, and if you’re on WSL2 Linux like me, add or export the LD_LIBRARY_PATH. I did this:

(kohya) nano@DESKTOP-73RPGPM:~/kohya_ss$ find / -name libnvinfer.so.8
/home/nano/anaconda3/envs/kohya/lib/python3.10/site-packages/tensorrt/libnvinfer.so.8

sudo ln -s /home/nano/anaconda3/envs/kohya/lib/python3.10/site-packages/tensorrt/libnvinfer.so.8 /home/nano/anaconda3/envs/kohya/lib/python3.10/site-packages/tensorrt/libnvinfer.so.7
sudo ln -s /home/nano/anaconda3/envs/kohya/lib/python3.10/site-packages/tensorrt/libnvinfer_plugin.so.8 /home/nano/anaconda3/envs/kohya/lib/python3.10/site-packages/tensorrt/libnvinfer_plugin.so.7
libnvinfer_plugin.so.7
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/nano/anaconda3/envs/kohya/lib/python3.10/site-packages/tensorrt/

Thanks to xxy1836 for the workaround.