Problem loading library 'libnvinfer.so.7' when using transformers in python

Dear HPC team

I am trying to set a pipeline to use Llama2 for some research test. I am not expoert, and want to use the pipeline framework from Huggingface.
I installed all the libraries in a virtual python environment (baobab_python_env_LLM1).
When loading the library:

from transformers import pipeline

I get two warning message

2023-10-20 11:48:40.198662: W tensorflow/compiler/xla/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: /opt/ebsofts/MPI/GCC/8.2.0-2.31.1/OpenMPI/3.1.3/SciPy-bundle/2019.03/lib/python2.7/site-packages/numpy/core/lib:/opt/ebsofts/MPI/GCC/8.2.0-2.31.1/OpenMPI/3.1.3/SciPy-bundle/2019.03/lib/python3.7/site-packages/numpy/core/lib:/opt/ebsofts/MPI/GCC/8.2.0-2.31.1/OpenMPI/3.1.3/SciPy-bundle/2019.03/lib:/opt/ebsofts/MPI/GCC/8.2.0-2.31.1/OpenMPI/3.1.3/ScaLAPACK/2.0.2-OpenBLAS-0.3.5/lib:/opt/ebsofts/MPI/GCC/8.2.0-2.31.1/OpenMPI/3.1.3/FFTW/3.3.8/lib:/opt/ebsofts/Compiler/GCC/8.2.0-2.31.1/OpenBLAS/0.3.5/lib:/opt/ebsofts/Python/3.7.2-GCCcore-8.2.0/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/libffi/3.2.1/lib64:/opt/ebsofts/Compiler/GCCcore/8.2.0/libffi/3.2.1/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/GMP/6.1.2/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/SQLite/3.27.2/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/Tcl/8.6.9/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/libreadline/8.0/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/ncurses/6.1/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/bzip2/1.0.6/lib:/opt/ebsofts/OpenMPI/3.1.3-GCC-8.2.0-2.31.1/lib:/opt/ebsofts/hwloc/1.11.11-GCCcore-8.2.0/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/libpciaccess/0.14/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/libxml2/2.9.8/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/XZ/5.2.4/lib:/opt/ebsofts/numactl/2.0.12-GCCcore-8.2.0/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/zlib/1.2.11/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/binutils/2.31.1/lib:/opt/ebsofts/Core/GCCcore/8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0:/opt/ebsofts/Core/GCCcore/8.2.0/lib64:/opt/ebsofts/Core/GCCcore/8.2.0/lib
2023-10-20 11:48:40.202373: W tensorflow/compiler/xla/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: /opt/ebsofts/MPI/GCC/8.2.0-2.31.1/OpenMPI/3.1.3/SciPy-bundle/2019.03/lib/python2.7/site-packages/numpy/core/lib:/opt/ebsofts/MPI/GCC/8.2.0-2.31.1/OpenMPI/3.1.3/SciPy-bundle/2019.03/lib/python3.7/site-packages/numpy/core/lib:/opt/ebsofts/MPI/GCC/8.2.0-2.31.1/OpenMPI/3.1.3/SciPy-bundle/2019.03/lib:/opt/ebsofts/MPI/GCC/8.2.0-2.31.1/OpenMPI/3.1.3/ScaLAPACK/2.0.2-OpenBLAS-0.3.5/lib:/opt/ebsofts/MPI/GCC/8.2.0-2.31.1/OpenMPI/3.1.3/FFTW/3.3.8/lib:/opt/ebsofts/Compiler/GCC/8.2.0-2.31.1/OpenBLAS/0.3.5/lib:/opt/ebsofts/Python/3.7.2-GCCcore-8.2.0/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/libffi/3.2.1/lib64:/opt/ebsofts/Compiler/GCCcore/8.2.0/libffi/3.2.1/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/GMP/6.1.2/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/SQLite/3.27.2/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/Tcl/8.6.9/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/libreadline/8.0/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/ncurses/6.1/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/bzip2/1.0.6/lib:/opt/ebsofts/OpenMPI/3.1.3-GCC-8.2.0-2.31.1/lib:/opt/ebsofts/hwloc/1.11.11-GCCcore-8.2.0/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/libpciaccess/0.14/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/libxml2/2.9.8/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/XZ/5.2.4/lib:/opt/ebsofts/numactl/2.0.12-GCCcore-8.2.0/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/zlib/1.2.11/lib:/opt/ebsofts/Compiler/GCCcore/8.2.0/binutils/2.31.1/lib:/opt/ebsofts/Core/GCCcore/8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0:/opt/ebsofts/Core/GCCcore/8.2.0/lib64:/opt/ebsofts/Core/GCCcore/8.2.0/lib
2023-10-20 11:48:40.202412: 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 don’t really know what to do. Looking in internet, some people did add symbolic links to newer version of the library

# the following path will be different for you - depending on your install method
$ cd env/lib/python3.10/site-packages/tensorrt

# create symbolic links
$ ln -s libnvinfer_plugin.so.8 libnvinfer_plugin.so.7
$ ln -s libnvinfer.so.8 libnvinfer.so.7

(tensorflow - Could not load dynamic library 'libnvinfer.so.7' - Stack Overflow)

which I could do I guess. I just wanted to have your opinion, if it safe to do so, and if it could work within the virtual environnement

Thank you for your help

At the end creating the virtual link worked out (I had to locate the folder, which was in my virtual environnement). It need to be created each time I run the job, so I added the line to my bash file lauching the jobs.

Hi @Denis.Mongin

Could you give the command you execute to create the link ? That’s weird you need to do it each time ?

I did

ln -s libnvinfer_plugin.so.8 libnvinfer_plugin.so.7