TensorFlow - GPU installation issue

Dear all,
I recently bought a brand new computer with a RTX 3060 graphic card in order to do deep learning.
I try to install the GPU but I have some issues.
I installed tensorflow followig the procedure:

But when I write the following command:

python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

I have the following message:

python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
2022-12-02 11:38:54.436050: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-12-02 11:38:54.944658: 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: :/home/jacquin/anaconda3/lib/
2022-12-02 11:38:54.944708: 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: :/home/jacquin/anaconda3/lib/
2022-12-02 11:38:54.944715: 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.
2022-12-02 11:38:55.613255: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-12-02 11:38:55.617228: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-12-02 11:38:55.617375: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

Anyone can help me ?

Hi there,

I was getting similar messages to your first couple. Specifically around libnvinfer.so.7.

The problem seems to be incompatible versions of TensorRT and TensorFlow 2.11.
To fix this problem I had to install tf-nightly and add “$CONDA_PREFIX/lib/python3.10/site-packages/tensorrt/” the LD_LIBRARY_PATH env variable.

I found some useful info in these issue on github:
https://github.com/tensorflow/tensorflow/issues/57671,https://github.com/tensorflow/tensorflow/issues/57671

Apparently it will be fixed in the Tensorflow2.12 stable release whenever that is. There is also the option of downgrading to various python versions and package versions however I have a slightly abnormal setup (I’m running arch on wsl2) so getting previous versions of the nvidia libraries was a nightmare.

Hope this helps!

1 Like

Thank you for your answer.
I don’t wan’t to downgrade python as I know it will bring new issues with other softwares.
I don’t understand the sentence: add “$CONDA_PREFIX/lib/python3.10/site-packages/tensorrt/” the LD_LIBRARY_PATH env variable.
Could you explain better ?
Thanks
Thibaut

Hi,

No problem. If you look at your error message it is looking for libnvinfer.so.7 in the directory in the environment variable $LD_LIBRARY_PATH.

When you installed tensor flow you probably copied the script that creates this variable everytime you activate your virtual environment. You will need to go to where that script is located (refer to the steps you took to create it) and add the
location of the libnvinfer.so.8 library which for me was in:

$CONDA_PREFIX/lib/python3.10/site-packages/tensorrt/

$CONDA_PREFIX is an environment variable that points to your env root folder.

If you uninstall tensorflow 2.11 and install the pip package “tf-nightly” you shouldn’t have to downgrade. It is the development branch of tensorflow and this dependency mismatch has been fixed there but not in the current stable release.

Try to read through the links I posted. There is a lot of info in there and people who have had and fixed the same problem in various ways.

1 Like

Sorry I am lost !
The libnvinfer.so.8 is located in the following folder:
/home/jacquin/anaconda3/envs/tf-py38/lib/python3.8/site-packages
I did not find the libnvinfer.so.7 file
$LD_LIBRARY_PATH is /home/jacquin/miniconda3/lib/

tensorRT on system. python 3.10+ RT 8+
cd /usr/lib/x86_64-linux-gnu
ln -s libnvinfer.so.8 libnvinfer.so.7
ln -s libnvinfer_plugin.so.8 libnvinfer_plugin.so.7
ln -s libnvonnxparser.so.8 libnvonnxparser.so.7
ln -s libnvparsers.so.8 libnvparsers.so.7

For virtual environment only create symbolic links.

Hi,

No issue. If you look at your error message, libnvinfer.so is being sought after. LD LIBRARY PATH’s environment variable lists 7 in the directory.

You duplicated the script that produces this variable each time your virtual environment is activated when you installed TensorFlow, most likely. You must visit the location of the script (remember the procedures you used to generate it) and add the