Couldn't resolve TF-TRT Warning: Could not find TensorRT
@MohanKrishnaGR The standard approach of installing TensorRT directly on your Windows host might not work for WSL 2. Instead, you'll need to install it within the WSL 2 environment itself. Please make sure to follow [these](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html) instructions.  Within your WSL 2 environment, please print the value of LD_LIBRARY_PATH to confirm it includes the TensorRT directory and let us know?

Thank you! I still did not solve TensorRT problem ("TF-TRT Warning: Could not find TensorRT")

WSL2, Ubuntu 22.04, RTX 3090, Python 3.11, TensorFlow 2.15.1
(I installed TensorFlow as `pip install tensorflow[and-cuda]==2.15.1`)

Once I execute 
```
python3 -c "import tensorflow.compiler as tf_cc; \
print(tf_cc.tf2tensorrt._pywrap_py_utils.get_linked_tensorrt_version())"
```

I get the following error

```
2024-05-28 11:29:40.984287: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-05-28 11:29:40.984330: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-05-28 11:29:40.984879: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-05-28 11:29:40.988008: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-05-28 11:29:41.499909: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
(8, 6, 1)
```

So, obviously, I need 8.6.1 version of TensorRT and I downloaded "TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0.tar.gz"
After extract it, moved folder to "~/local/opt/TensorRT-8.6.1.6"

For example, 
```
(tf_215_py_311_wsl) enhorse@DESKTOP-5950X:~/local/opt/TensorRT-8.6.1.6$ ls
bin  data  doc  graphsurgeon  include  lib  onnx_graphsurgeon  python  samples  targets  uff
```

Following Nvidia's installation instruction (https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing-tar)

I did

```
python3 -m pip install tensorrt-8.6.1-cp311-none-linux_x86_64.whl
python3 -m pip install tensorrt_lean-8.6.1-cp311-none-linux_x86_64.whl
python3 -m pip install tensorrt_dispatch-8.6.1-cp311-none-linux_x86_64.whl
python3 -m pip install onnx_graphsurgeon-0.3.12-py2.py3-none-any.whl
```

I added followings after open `sudo nano ~/.bashrc`

export LD_LIBRARY_PATH=/home/enhorse/local/opt/TensorRT-8.6.1.6/lib:$LD_LIBRARY_PATH
export TensorRT_ROOT=/home/enhorse/local/opt/TensorRT-8.6.1.6


When I execute the commend
`strace -e open,openat python -c "import tensorflow as tf" 2>&1 | grep "libnvinfer\|TF-TRT"`

I got as follows:
```
openat(AT_FDCWD, "/home/enhorse/local/opt/TensorRT-8.6.1.6/lib/libnvinfer.so.8.6.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/enhorse/local/opt/TensorRT-8.6.1.6/lib/libnvinfer_plugin.so.8.6.1", O_RDONLY|O_CLOEXEC) = 3
2024-05-28 11:41:21.209619: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT

```


I still have no idea what I can do more. Is there something wrong in my installation?
 @MohanKrishnaGR The library paths mentioned (/home/enhorse/local/opt/TensorRT-8.6.1.6/lib) might be incorrect or not set properly in the environment variables.

Kindly verify that and let us know?
Thank you! Thanks, @sushreebarsa !
for 
```
echo $LD_LIBRARY_PATH
```
I got:
```
/usr/local/cuda/lib64:/home/mohan/TensorRT-10.0.1.6/lib:
```
But still the TRT Warning:  Could not find TensorRT exits:
```
(env) mohan@LAPTOP-INPO8147:~$ python3 -c "import tensorflow.compiler as tf_cc; \
print(tf_cc.tf2tensorrt._pywrap_py_utils.get_linked_tensorrt_version())"

2024-05-30 19:12:05.605386: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-05-30 19:12:05.646956: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-05-30 19:12:05.647012: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-05-30 19:12:05.647739: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-05-30 19:12:05.654095: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-05-30 19:12:06.221625: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
(8, 6, 1)
``` @MohanKrishnaGR,
Could you please try to execute the below commands and let us know if it working in Tensorflow v2.16.1

```python
cd ~/miniconda3/envs/cuda12/lib/python3.11/site-packages/tensorrt_libs/
ln -s libnvinfer.so.10 libnvinfer.so.8.6.1
ln -s libnvinfer_plugin.so.10 libnvinfer_plugin.so.8.6.1
```
https://github.com/tensorflow/tensorflow/issues/64809#issuecomment-2147599600

Thank you!
Couldn't resolve TF-TRT Warning: Could not find TensorRT

I'm using wsl2 in windows 11.

```
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy
```
Previously, I wasn't able to have GPU as the backend, I had tried all the methods in installing tensorflow in wsl. 

But, trying with python3.11 and tensorflow  2.15.1, got me access to the GPU backend. 

```
conda create -n tmpenv python=3.11
conda activate tmpenv
pip install tensorflow[and-cuda]==2.15.1
```

versions:
```
tensorflow                    2.15.1
tensorrt                      10.0.1
```
nvidia-smi:
```
Tue May 21 15:45:23 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.76.01              Driver Version: 552.44         CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4080 ...    On  |   00000000:01:00.0 Off |                  N/A |
| N/A   38C    P4             17W /   55W |       0MiB /  12282MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+
```
```
2024-05-21 15:46:26.487553: I external/local_xla/xla/service/service.cc:168] XLA service 0x7fcc3f7b2c00 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2024-05-21 15:46:26.487663: I external/local_xla/xla/service/service.cc:176]   StreamExecutor device (0): NVIDIA GeForce RTX 4080 Laptop GPU, Compute Capability 8.9
```
I've tried all ways of installing tensorrt - pip, .deb, .tar;
updated path variable, etc.
Its importing in python shell

```
>>> import tensorrt as trt
>>> trt.__version__
'10.0.1'
>>> trt.__file__
'/home/mohan/miniconda3/envs/tmpenv/lib/python3.11/site-packages/tensorrt/__init__.py'
```
All the files are available (.tar installation method)
```
(tmpenv) mohan@LAPTOP-INPO8147:~$ ls TensorRT-10.0.1.6/
bin  data  doc  include  lib  onnx_graphsurgeon  python  samples  targets

(tmpenv) mohan@LAPTOP-INPO8147:~$ ls TensorRT-10.0.1.6/lib/
libnvinfer.so                          libnvinfer_plugin.so.10.0.1
libnvinfer.so.10                       libnvinfer_plugin_static.a
libnvinfer.so.10.0.1                   libnvinfer_static.a
libnvinfer_builder_resource.so.10.0.1  libnvinfer_vc_plugin.so
libnvinfer_dispatch.so                 libnvinfer_vc_plugin.so.10
libnvinfer_dispatch.so.10              libnvinfer_vc_plugin.so.10.0.1
libnvinfer_dispatch.so.10.0.1          libnvinfer_vc_plugin_static.a
libnvinfer_dispatch_static.a           libnvonnxparser.so
libnvinfer_lean.so                     libnvonnxparser.so.10
libnvinfer_lean.so.10                  libnvonnxparser.so.10.0.1
libnvinfer_lean.so.10.0.1              libnvonnxparser_static.a
libnvinfer_lean_static.a               libonnx_proto.a
libnvinfer_plugin.so                   stubs
libnvinfer_plugin.so.10

(tmpenv) mohan@LAPTOP-INPO8147:~/TensorRT-10.0.1.6/python$ ls
tensorrt-10.0.1-cp310-none-linux_x86_64.whl
tensorrt-10.0.1-cp311-none-linux_x86_64.whl
tensorrt-10.0.1-cp312-none-linux_x86_64.whl
tensorrt-10.0.1-cp38-none-linux_x86_64.whl
tensorrt-10.0.1-cp39-none-linux_x86_64.whl
tensorrt_dispatch-10.0.1-cp310-none-linux_x86_64.whl
tensorrt_dispatch-10.0.1-cp311-none-linux_x86_64.whl
tensorrt_dispatch-10.0.1-cp312-none-linux_x86_64.whl
tensorrt_dispatch-10.0.1-cp38-none-linux_x86_64.whl
tensorrt_dispatch-10.0.1-cp39-none-linux_x86_64.whl
tensorrt_lean-10.0.1-cp310-none-linux_x86_64.whl
tensorrt_lean-10.0.1-cp311-none-linux_x86_64.whl
tensorrt_lean-10.0.1-cp312-none-linux_x86_64.whl
tensorrt_lean-10.0.1-cp38-none-linux_x86_64.whl
tensorrt_lean-10.0.1-cp39-none-linux_x86_64.whl
```

I've also used the files from .tar method to install using pip:
```
(tmpenv) mohan@LAPTOP-INPO8147:~/TensorRT-10.0.1.6/python$ python3 -m pip install tensorrt-10.0.1-cp311-none-linux_x86_64.whl
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Processing ./tensorrt-10.0.1-cp311-none-linux_x86_64.whl
tensorrt is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.

(tmpenv) mohan@LAPTOP-INPO8147:~/TensorRT-10.0.1.6/python$ python3 -m pip install tensorrt_dispatch-10.0.1-cp311-none-linux_x86_64.whl
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Processing ./tensorrt_dispatch-10.0.1-cp311-none-linux_x86_64.whl
tensorrt-dispatch is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.

(tmpenv) mohan@LAPTOP-INPO8147:~/TensorRT-10.0.1.6/python$ python3 -m pip install tensorrt_lean-10.0.1-cp311-none-linux_x86_64.whl
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Processing ./tensorrt_lean-10.0.1-cp311-none-linux_x86_64.whl
tensorrt-lean is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
```
But still I get this error

```
2024-05-21 15:46:19.659564: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
```

_Originally posted by @MohanKrishnaGR in https://github.com/tensorflow/tensorflow/issues/64809#issuecomment-2122328887_
            