Skip to content

Instantly share code, notes, and snippets.

@shirayu
Last active June 20, 2025 01:36
Show Gist options
  • Select an option

  • Save shirayu/3efee7f6168e49e9b66e035fa3cca61d to your computer and use it in GitHub Desktop.

Select an option

Save shirayu/3efee7f6168e49e9b66e035fa3cca61d to your computer and use it in GitHub Desktop.
TensorRT + Ubuntu 22.04 (on WSL2)

TensorRT + Ubuntu 22.04 (on WSL2)

I received the following warnings related to libnvinfer.so.7 and libnvinfer_plugin.so.7

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; LD_LIBRARY_PATH: xxxxx
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; LD_LIBRARY_PATH: xxxxx
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.
  1. Download TAR Package NVIDIA TensorRT from here
$ tar xf TensorRT-8.5.2.2.Linux.x86_64-gnu.cuda-11.8.cudnn8.6.tar.gz
$ mkdir -p ~/local/opt
$ mv TensorRT-8.5.2.2 ~/local/opt
$ cd local/TensorRT-8.5.2.2
$ ln -s libnvinfer.so.8.5.2 libnvinfer.so.7
$ ln -s libnvinfer_plugin.so.8.5.2 libnvinfer_plugin.so.7
  1. Add following lines to ~/.bashrc or ~/.bashenv (For bash users)
export LD_LIBRARY_PATH=~/local/opt/TensorRT-8.5.2.2/lib:$LD_LIBRARY_PATH
export TensorRT_ROOT=~/local/opt/TensorRT-8.5.2.2

Useful links

@shirayu
Copy link
Author

shirayu commented Jun 15, 2024

Great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment