Libnvinfer.so.8 error while running sampleMNIST sample

Hi,
I have just installed TensorRT-8.4.0.6 and I can’t seem to be able to run the sampleMNIST example.
Here the detailed info:

  • uname -a:
Linux ip-<my ip> 5.4.0-1066-aws #69~18.04.1-Ubuntu SMP Wed Feb 9 15:36:54 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Here what I have added to ~/.bashrc

# set env for TensorRT
export TENSORRT_DIR=$/home/ubuntu/TensorRT-8.4.0.6
export LD_LIBRARY_PATH=$TENSORRT_DIR/lib:$TENSORRT_DIR

Here what I have added to ~/.profile

# set PATH for cuda 10.2 installation
if [ -d "/usr/local/cuda-10.2/bin/" ]; then
    export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
fi

Here what my TensorRT-8.4.0.6 looks like

I have already built the sample, so now when I execute make from the directory I get the following


as a result, a sample_mnist file has been created inside /home/ubuntu/TensorRT-8.4.0.6/bin.
Inside the /home/ubuntu/TensorRT-8.4.0.6/samples/sampleMNIST I have created a mnist folder with the requested images
image

How do I execute the sample now?
This is what I tried from within the /home/ubuntu/TensorRT-8.4.0.6/bin directory
./sample_mnist --datadir=../samples/sampleMNIST/mnist --fp16
which raises

./sample_mnist: error while loading shared libraries: libnvinfer.so.8: cannot open shared object file: No such file or directory

Is this the right way to run the test sample?
If yes, am I just missing something super silly with PATHs?

Hi,
Please refer to the below link for Sample guide.

Refer to the installation steps from the link if in case you are missing on anything

However suggested approach is to use TRT NGC containers to avoid any system dependency related issues.

In order to run python sample, make sure TRT python packages are installed while using NGC container.
/opt/tensorrt/python/python_setup.sh

In case, if you are trying to run custom model, please share your model and script with us, so that we can assist you better.
Thanks!

Thanks for the prompt reply.
Much appreciated.

I am tracing my steps and trying to figure things out.
Keep you posted

Alright, apparently I had to append /home/ubuntu/TensorRT-8.4.0.6/lib to LD_LIBRARY_PATH .
Now it looks like this

$/home/ubuntu/TensorRT-8.4.0.6/lib:$/home/ubuntu/TensorRT-8.4.0.6:/home/ubuntu/TensorRT-8.4.0.6/lib

I think the first part is actually not needed, e.g. I am repeating /home/ubuntu/TensorRT-8.4.0.6/lib twice.

Anyway, thanks for the input!

1 Like