此次报错出在paddlepaddle-gpu环境出错上
本机环境为ubuntu16.04,虽然版本较低,但所遇到的问题几乎适用于所有版本(如有错误请纠正)
一、libssl.so.1.1: cannot open shared object file: No such file or directory
首先确保自己通过paddlepaddle官网安装步骤是正确,CUDA版本也确认过对应无误!!
然后就在通过以下语句:python
import paddle
paddle.utils.run_check()
验证是否安装成功时产生了报错:
python
Python 3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 19:11:38)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
Error: Can not import paddle core while this file exists: /home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/libpaddle.so
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/__init__.py", line 31, in <module>
from .framework import monkey_patch_variable
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/framework/__init__.py", line 17, in <module>
from . import random # noqa: F401
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/framework/random.py", line 17, in <module>
from paddle import fluid
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/__init__.py", line 36, in <module>
from . import framework
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/framework.py", line 35, in <module>
from . import core
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/core.py", line 356, in <module>
raise e
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/core.py", line 269, in <module>
from . import libpaddle
ImportError: /usr/lib/libssl.so.1.1: symbol ENGINE_set_tass_flags, version OPENSSL_1_1_1b not defined in file libcrypto.so.1.1 with link time reference
>>> exit()
经查询发现,这些.so文件并非是我们系统中没有,只是没有在指定的位置,所以找不到。
于是我们将找到的文件放到正确的地方即可:
1.先找到系统中这些文件所在的位置
sudo find / -name libssl.so.1.1/usr/lib/libssl.so.1.1
2.查询结果如下
find: `/run/user/1000/gvfs': 权限不够
/opt/kingsoft/wps-office/office6/libssl.so.1.1
/var/lib/docker/aufs/diff/a1553a2332d791f53183476f9942848ce98a9f27302ce125e16e430efb994c0a/usr/lib/x86_64-linux-gnu/libssl.so.1.1
/home/zero/anaconda3/lib/libssl.so.1.1
/home/zero/anaconda3/pkgs/openssl-1.1.1u-hd590300_0/lib/libssl.so.1.1
/home/zero/anaconda3/pkgs/openssl-1.1.1k-h27cfd23_0/lib/libssl.so.1.1
/home/zero/anaconda3/pkgs/openssl-1.1.1h-h7b6447c_0/lib/libssl.so.1.1
/home/zero/anaconda3/pkgs/openssl-1.1.1w-hd590300_0/lib/libssl.so.1.1
/home/zero/anaconda3/pkgs/openssl-1.1.1k-h7f98852_0/lib/libssl.so.1.1
/home/zero/anaconda3/envs/yolov7/lib/libssl.so.1.1
/home/zero/anaconda3/envs/pytorch/lib/libssl.so.1.1
/home/zero/anaconda3/envs/alphapose/lib/libssl.so.1.1
/home/zero/anaconda3/envs/FaceRecognition/lib/libssl.so.1.1
/home/zero/anaconda3/envs/paddleEnv/lib/libssl.so.1.1
3.找到随便一个作出如下更改:
sudo cp /home/zero/anaconda3/envs/pytorch/lib/libssl.so.1.1 /usr/lib
4.此时会发现该报错已经消失,但是有可能出现新的相似报错,用该方法同样可以解决
二、PreconditionNotMetError: Cannot load cudnn shared library. Cannot invoke method cudnnGetVersion.
具体是在这里触发的:
python
Python 3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 19:11:38)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ...
I1023 21:03:54.605382 30889 interpretercore.cc:237] New Executor is Running.
W1023 21:03:54.605722 30889 gpu_resources.cc:96] The GPU architecture in your current machine is Maxwell, which is not compatible with Paddle installation with arch: 70 75 80 86 , it is recommended to install the corresponding wheel package according to the installation information on the official Paddle website.
W1023 21:03:54.605732 30889 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 5.2, Driver API Version: 11.3, Runtime API Version: 11.7
W1023 21:03:54.605855 30889 dynamic_loader.cc:303] The third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctly. (error code is /usr/local/cuda/lib64/libcudnn.so: cannot open shared object file: No such file or directory)
Suggestions:
1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
2. Configure third-party dynamic library environment variables as follows:
- Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
- Windows: set PATH by `set PATH=XXX;
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/utils/install_check.py", line 249, in run_check
_run_static_single(use_cuda, use_xpu)
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/utils/install_check.py", line 146, in _run_static_single
exe.run(startup_prog)
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1392, in run
res = self._run_impl(
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1618, in _run_impl
ret = new_exe.run(
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/executor.py", line 654, in run
tensors = self._new_exe.run(
RuntimeError: In user code:
File "<stdin>", line 1, in <module>
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/utils/install_check.py", line 249, in run_check
_run_static_single(use_cuda, use_xpu)
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/utils/install_check.py", line 133, in _run_static_single
input, out, weight = _simple_network()
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/utils/install_check.py", line 31, in _simple_network
weight = paddle.create_parameter(
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/tensor/creation.py", line 222, in create_parameter
return helper.create_parameter(
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/layer_helper_base.py", line 432, in create_parameter
self.startup_program.global_block().create_parameter(
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/framework.py", line 3935, in create_parameter
initializer(param, self)
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/nn/initializer/initializer.py", line 40, in __call__
return self.forward(param, block)
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/nn/initializer/constant.py", line 65, in forward
op = block.append_op(
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/framework.py", line 4013, in append_op
op = Operator(
File "/home/zero/anaconda3/envs/paddleEnv/lib/python3.8/site-packages/paddle/fluid/framework.py", line 2781, in __init__
for frame in traceback.extract_stack():
PreconditionNotMetError: Cannot load cudnn shared library. Cannot invoke method cudnnGetVersion.
[Hint: cudnn_dso_handle should not be null.] (at ../paddle/phi/backends/dynload/cudnn.cc:64)
[operator < fill_constant > error]
>>> exit()
该问题同样也是,cudnn我们可以查询到在相应anaconda环境下的envs的lib中是存在的:
(paddleEnv) zero@zero:~$ which python
/home/zero/anaconda3/envs/paddleEnv/bin/python
(paddleEnv) zero@zero:~$ ls /home/zero/anaconda3/envs/paddleEnv/lib/
libcudart.so libnvblas.so.11.4.1.1043
libcudart.so.11.0 libnvjpeg.so
libcudart.so.11.2.152 libnvjpeg.so.11
libcudnn_adv_infer.so libnvjpeg.so.11.4.0.152
libcudnn_adv_infer.so.8 libnvrtc-builtins.so
libcudnn_adv_infer.so.8.2.1 libnvrtc-builtins.so.11.2
libcudnn_adv_train.so libnvrtc-builtins.so.11.2.152
libcudnn_adv_train.so.8 libnvrtc.so
libcudnn_adv_train.so.8.2.1 libnvrtc.so.11.2
libcudnn_cnn_infer.so libnvrtc.so.11.2.152
libcudnn_cnn_infer.so.8 libnvToolsExt.so
libcudnn_cnn_infer.so.8.2.1 libnvToolsExt.so.1
libcudnn_cnn_train.so libnvToolsExt.so.1.0.0
libcudnn_cnn_train.so.8 libnvvm.so
libcudnn_cnn_train.so.8.2.1 libnvvm.so.4
libcudnn_ops_infer.so libnvvm.so.4.0.0
libcudnn_ops_infer.so.8 libopenblasp-r0.3.24.so
libcudnn_ops_infer.so.8.2.1 libopenblas.so.0
libcudnn_ops_train.so libopenjp2.a
libcudnn_ops_train.so.8 libopenjp2.so
libcudnn_ops_train.so.8.2.1 libopenjp2.so.2.4.0
libcudnn.so libopenjp2.so.7
libcudnn.so.8 libpanel.so
libcudnn.so.8.2.1 libpanel.so.6
...
可以看到,该有的包我们都有,但还是有报错,这是因为需要的cuda、cudnn都已经安装,出现这个问题是找不到对应的动态库,所以要针对性处理。
1.首先,我们先打开系统配置文件
gedit ~/.bashrc
2.使用以下语句将刚才找到这些动态库的目录配置到文件末尾,切记是末尾,如果有别的LD_LIBRARY_PATH,切记要注释掉:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/zero/anaconda3/envs/paddleEnv/lib/
3.别忘了保存完该文件需要激活一下:
source ~/.bashrc
4.然后继续测试paddle环境是否安装好文章来源:https://www.toymoban.com/news/detail-754293.html
import paddle
paddle.utils.run_check()
5.显示下面的就安装成功了文章来源地址https://www.toymoban.com/news/detail-754293.html
(paddleEnv) zero@zero-Z97-HD3:~$ python
Python 3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 19:11:38)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ...
I1023 21:39:20.841471 4339 interpretercore.cc:237] New Executor is Running.
W1023 21:39:20.841838 4339 gpu_resources.cc:96] The GPU architecture in your current machine is Maxwell, which is not compatible with Paddle installation with arch: 70 75 80 86 , it is recommended to install the corresponding wheel package according to the installation information on the official Paddle website.
W1023 21:39:20.841848 4339 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 5.2, Driver API Version: 11.3, Runtime API Version: 11.2
W1023 21:39:20.843921 4339 gpu_resources.cc:149] device: 0, cuDNN Version: 8.2.
I1023 21:39:38.545578 4339 interpreter_util.cc:518] Standalone Executor is Used.
PaddlePaddle works well on 1 GPU.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
>>> exit()
如果帮助到你了,请点个赞哦!~
到了这里,关于【paddle本地环境安装踩坑记录】libssl.so.1.1...PreconditionNotMetError...的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!