Tensorflow GPU 问题 'libnvinfer.so.7' 和 ''libnvinfer.so.7'' 无法加载

问题描述 投票:0回答:1

我在 wsl2 ubuntu22.04 下安装了 tensorflow 我按照以下说明操作: https://www.tensorflow.org/install/pip *我还为 Windows 安装了 nvidia 驱动程序,在我的其他 wsl2 中,我使用了 gpu 支持的模拟程序。

一切似乎都很好。我在安装过程中没有收到任何错误消息,但是当我在 python3 中导入 tensorflow 时,我收到了这个错误:

2023-02-12 14:49:58.544771: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvrtc.so.11.0: cannot open shared object file: No such file or directory
2023-02-12 14:49:58.544845: 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
2023-02-12 14:49:58.544874: 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.

我搜索了我的 libnvinfer_plugin.so.7 文件:

sudo find / -name libnvinfer.so.7  2> /dev/null

我在这个目录中找到了它们:

cat /usr/lib/x86_64-linux-gnu/libnvinfer.so.7

我将此目录添加到 LD_LIBRARY_PATH,如下所示:Could not load dynamic library 'libnvinfer.so.7' 但没有任何改变。 tensorflow 仍在工作,但不能使用 gpu。

nvidia-smi:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.65.01    Driver Version: 516.94       CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| 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 ...  On   | 00000000:01:00.0 Off |                  N/A |
| N/A   43C    P0    22W /  N/A |      0MiB /  6144MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

nvcc--版本:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Fri_Jan__6_16:45:21_PST_2023
Cuda compilation tools, release 12.0, V12.0.140
Build cuda_12.0.r12.0/compiler.32267302_0

*tf 版本为:2.11.0

那么,我该如何解决这个问题?

python tensorflow gpu lib
1个回答
0
投票

我换了版本,问题解决了:

pip install --upgrade tensorflow==2.8

注意:当我使用v2.10时,我得到同样的错误信息。 v2.8 现在稳定了。

© www.soinside.com 2019 - 2024. All rights reserved.