Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TensorFlow TensorRT Warning - Could not find TensorRT

I'm encountering an issue with TensorFlow while using TensorRT. The warning message I receive is as follows:

2023-07-28 16:27:20.817724: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT

I have already tried installing TensorRT and its dependencies correctly on my system, but the issue persists. My setup includes TensorFlow and an NVIDIA GPU with compatible drivers.

Has anyone encountered a similar problem or has suggestions on how to resolve this? Any guidance on troubleshooting and fixing this warning would be greatly appreciated.

Thank you for your help!

like image 424
Pavlo Baranchuk Avatar asked Jul 29 '26 08:07

Pavlo Baranchuk


1 Answers

First of all, if you have not installed already, try to install it via pip: pip install tensorrt

Strangely, simply installing it does not help on my side. As if the path it looks for has changed across versions. If installing does not help for you either, try:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path to your python libs>/tensorrt_libs/

My bet is this will be enough. However, if you additionally run into a version compatibility issue (say *.so.7 vs *.so.8), you can circumvent in some cases by adding symlinks into the same tensorrt_libs directory.

You can check which files (and paths and versions) tf is looking for by inspecting the output of: strace -e open,openat python -c "import tensorflow as tf" 2>&1 | grep "libnvinfer\|TF-TRT"

like image 106
Copper Avatar answered Aug 01 '26 04:08

Copper



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!