Paddle import paddle时出错

svujldwt  于 2021-11-29  发布在  Java
关注(0)|答案(12)|浏览(529)

AIstudio上用GPU训练模型时

Error: Can not import avx core while this file exists: /root/miniconda3/lib/python3.6/site-packages/paddle/fluid/core_avx.so

torch版本: 1.9.0+cu102
cuda版本: 10.2
cudnn版本: 7605

Traceback (most recent call last):
File "test.py", line 9, in <module>
import paddle
File "/root/miniconda3/lib/python3.6/site-packages/paddle/__init__.py", line 25, in <module>
from .fluid import monkey_patch_variable
File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/__init__.py", line 36, in <module>
from . import framework
File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/framework.py", line 37, in <module>
from . import core
File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/core.py", line 297, in <module>
raise e
File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/core.py", line 257, in <module>
from .core_avx import *
ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /root/miniconda3/lib/python3.6/site-packages/paddle/fluid/core_avx.so)
main process return code: 1
not found core file
w7t8yxp5

w7t8yxp51#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

zkure5ic

zkure5ic2#

gcc版本不够高,我估计你下载的是gcc8.2编译的包,可以在这里
https://www.paddlepaddle.org.cn/documentation/docs/zh/install/Tables.html#whl-release 这里找到一个gcc 5.4的

wlzqhblo

wlzqhblo3#

你好,我按照你的建议装了下面这个:

还是报同样的错误。

@bjjwwang

iq3niunx

iq3niunx4#

你那边GCC版本是多少
gcc --version
然后执行一个
strings /lib64/libstdc++.so.6 | grep GLIBCXX

hxzsmxv2

hxzsmxv25#

嗯嗯,这个报错好了~ 把5.4的换成了8.2的就解决了。

但是调用的时候出了下面的错误:
OSError:
C++ Traceback (most recent call last):
0 paddle::imperative::Tracer::TraceOp(std::string const&, paddle::imperative::NameVarBaseMap const&, paddle::imperative::NameVarBaseMap const&, paddle::framework::AttributeMap, paddle::platform::Place const&, bool, std::map<std::string, std::string, std::less<std::string >, std::allocator<std::pair<std::string const, std::string > > > const&)
1 paddle::imperative::PreparedOp::Prepare(paddle::imperative::NameVarBaseMap const&, paddle::imperative::NameVarBaseMap const&, paddle::framework::OperatorWithKernel const&, paddle::platform::Place const&, paddle::framework::AttributeMap const&)
2 paddle::imperative::PreparedOp paddle::imperative::PrepareImpl<paddle::imperative::VarBase>(paddle::imperative::details::NameVarMapTrait<paddle::imperative::VarBase>::Type const&, paddle::imperative::details::NameVarMapTrait<paddle::imperative::VarBase>::Type const&, paddle::framework::OperatorWithKernel const&, paddle::platform::Place const&, paddle::framework::AttributeMap const&)
3 paddle::platform::DeviceContextPool::Get(paddle::platform::Place const&)
4 std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<paddle::platform::EmplaceDeviceContext<paddle::platform::CUDADeviceContext, paddle::platform::CUDAPlace>(std::map<paddle::platform::Place, std::shared_future<std::unique_ptr<paddle::platform::DeviceContext, std::default_delete<paddle::platform::DeviceContext> > >, std::less<paddle::platform::Place>, std::allocator<std::pair<paddle::platform::Place const, std::shared_future<std::unique_ptr<paddle::platform::DeviceContext, std::default_delete<paddle::platform::DeviceContext> > > > > >*, paddle::platform::Place)::{lambda()#1}> >, std::unique_ptr<paddle::platform::DeviceContext, std::default_delete<paddle::platform::DeviceContext> > >::_M_complete_async()
5 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)
6 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<std::unique_ptr<paddle::platform::DeviceContext, std::default_delete<paddle::platform::DeviceContext> > >, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<paddle::platform::EmplaceDeviceContext<paddle::platform::CUDADeviceContext, paddle::platform::CUDAPlace>(std::map<paddle::platform::Place, std::shared_future<std::unique_ptr<paddle::platform::DeviceContext, std::default_delete<paddle::platform::DeviceContext> > >, std::less<paddle::platform::Place>, std::allocator<std::pair<paddle::platform::Place const, std::shared_future<std::unique_ptr<paddle::platform::DeviceContext, std::default_delete<paddle::platform::DeviceContext> > > > > >*, paddle::platform::Place)::{lambda()#1}> >, std::unique_ptr<paddle::platform::DeviceContext, std::default_delete<paddle::platform::DeviceContext> > > >::_M_invoke(std::_Any_data const&)
7 paddle::platform::CUDADeviceContext::CUDADeviceContext(paddle::platform::CUDAPlace)
8 paddle::platform::CUDAContext::CUDAContext(paddle::platform::CUDAPlace const&, paddle::platform::stream::Priority const&)
9 paddle::platform::CUDAContext::InitCuDNNContext()
10 paddle::platform::EnforceNotMet::EnforceNotMet(paddle::platform::ErrorSummary const&, char const*, int)
11 paddle::platform::GetCurrentTraceBackString[abi:cxx11]()
 
Error Message Summary:
ExternalError: Cudnn error, CUDNN_STATUS_NOT_INITIALIZED (at /paddle/paddle/fluid/platform/device_context.h:371)
[operator < gaussian_random > error]
main process return code: 1
not found core file

@bjjwwang

import torch
print("torch版本:", torch.__version__)
print("cuda版本:", torch.version.cuda)
print("cudnn版本:", torch.backends.cudnn.version())

torch版本: 1.9.0+cu102
cuda版本: 10.2
cudnn版本: 7605

9o685dep

9o685dep6#

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)

Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_DEBUG_MESSAGE_LENGTH
You are using Paddle compiled with TensorRT, but TensorRT dynamic library is not found. Ignore this if TensorRT is not needed.

wpcxdonn

wpcxdonn7#

好的
可以再搜一下
find / -name libcudnn.so.*
看看cudnn的so有没有

d7v8vwbk

d7v8vwbk8#

/usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudnn.so.7.6.5
/usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudnn.so.7
You are using Paddle compiled with TensorRT, but TensorRT dynamic library is not found. Ignore this if TensorRT is not needed.

@bjjwwang

sauutmhj

sauutmhj9#

需要 export LD_LIBRARY_PATH=/usr/local/cuda-10.1/targets/x86_64-linux/lib/:$LD_LIBRARY_PATH
然后再运行一遍看看

xzlaal3s

xzlaal3s10#

Cudnn error, CUDNN_STATUS_NOT_INITIALIZED 这个解决了,还有这个问题:

OSError:
C++ Traceback (most recent call last):

0 paddle::imperative::Tracer::TraceOp(std::string const&, paddle::imperative::NameVarBaseMap const&, paddle::imperative::NameVarBaseMap const&, paddle::framework::AttributeMap, paddle::platform::Place const&, bool, std::map<std::string, std::string, std::less<std::string >, std::allocator<std::pair<std::string const, std::string > > > const&)
1 paddle::imperative::PreparedOp::Prepare(paddle::imperative::NameVarBaseMap const&, paddle::imperative::NameVarBaseMap const&, paddle::framework::OperatorWithKernel const&, paddle::platform::Place const&, paddle::framework::AttributeMap const&)
2 paddle::imperative::PreparedOp paddle::imperative::PrepareImplpaddle::imperative::VarBase(paddle::imperative::details::NameVarMapTraitpaddle::imperative::VarBase::Type const&, paddle::imperative::details::NameVarMapTraitpaddle::imperative::VarBase::Type const&, paddle::framework::OperatorWithKernel const&, paddle::platform::Place const&, paddle::framework::AttributeMap const&)
3 paddle::platform::DeviceContextPool::Get(paddle::platform::Place const&)
4 std::__future_base::_Deferred_state<std:🧵:_Invoker<std::tuple<paddle::platform::EmplaceDeviceContext<paddle::platform::CUDADeviceContext, paddle::platform::CUDAPlace>(std::map<paddle::platform::Place, std::shared_future<std::unique_ptr<paddle::platform::DeviceContext, std::default_deletepaddle::platform::DeviceContext > >, std::lesspaddle::platform::Place, std::allocator<std::pair<paddle::platform::Place const, std::shared_future<std::unique_ptr<paddle::platform::DeviceContext, std::default_deletepaddle::platform::DeviceContext > > > > >*, paddle::platform::Place)::{lambda()#1}> >, std::unique_ptr<paddle::platform::DeviceContext, std::default_deletepaddle::platform::DeviceContext > >::_M_complete_async()

@bjjwwang

dldeef67

dldeef6711#

我现在训练的是paddleOCR,只用CPU是没问题的,就是用GPU就报错。

[2021/07/29 17:26:42] root INFO: Initialize indexs of datasets:['./train_data/rec/rec_gt_train_format.txt']
[2021/07/29 17:26:42] root INFO: Initialize indexs of datasets:['./train_data/rec/rec_gt_test_format.txt']
W0729 17:26:42.746572 829 device_context.cc:404] Please NOTE: device: 0, GPU Compute Capability: 6.0, Driver API Version: 10.1, Runtime API Version: 10.1
W0729 17:26:42.844444 829 device_context.cc:422] device: 0, cuDNN Version: 7.6.
Traceback (most recent call last):
File "tools/train.py", line 126, in <module>
main(config, device, logger, vdl_writer)
File "tools/train.py", line 77, in main
model = build_model(config['Architecture'])
File "/workspace/bin/ppocr/modeling/architectures/__init__.py", line 23, in build_model
module_class = BaseModel(config)
File "/workspace/bin/ppocr/modeling/architectures/base_model.py", line 52, in __init__
self.backbone = build_backbone(config["Backbone"], model_type)
File "/workspace/bin/ppocr/modeling/backbones/__init__.py", line 39, in build_backbone
module_class = eval(module_name)(**config)
File "/workspace/bin/ppocr/modeling/backbones/rec_mobilenet_v3.py", line 100, in __init__
name='conv1')
File "/workspace/bin/ppocr/modeling/backbones/det_mobilenet_v3.py", line 179, in __init__
bias_attr=False)
File "/root/miniconda3/lib/python3.6/site-packages/paddle/nn/layer/conv.py", line 646, in __init__
data_format=data_format)
File "/root/miniconda3/lib/python3.6/site-packages/paddle/nn/layer/conv.py", line 135, in __init__
default_initializer=_get_default_param_initializer())
File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 412, in create_parameter
default_initializer)
File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/layer_helper_base.py", line 374, in create_parameter

**attr._to_kwargs(with_initializer=True))

File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/framework.py", line 2858, in create_parameter
initializer(param, self)
File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/initializer.py", line 366, in __call__
stop_gradient=True)
File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/framework.py", line 2888, in append_op
kwargs.get("stop_gradient", False))
File "/root/miniconda3/lib/python3.6/site-packages/paddle/fluid/dygraph/tracer.py", line 45, in trace_op
not stop_gradient)
OSError:
 
C++ Traceback (most recent call last):

0 paddle::imperative::Tracer::TraceOp(std::string const&, paddle::imperative::NameVarBaseMap const&, paddle::imperative::NameVarBaseMap const&, paddle::framework::AttributeMap, paddle::platform::Place const&, bool, std::map<std::string, std::string, std::less<std::string >, std::allocator<std::pair<std::string const, std::string > > > const&)
1 paddle::imperative::PreparedOp::Prepare(paddle::imperative::NameVarBaseMap const&, paddle::imperative::NameVarBaseMap const&, paddle::framework::OperatorWithKernel const&, paddle::platform::Place const&, paddle::framework::AttributeMap const&)
2 paddle::imperative::PreparedOp paddle::imperative::PrepareImpl<paddle::imperative::VarBase>(paddle::imperative::details::NameVarMapTrait<paddle::imperative::VarBase>::Type const&, paddle::imperative::details::NameVarMapTrait<paddle::imperative::VarBase>::Type const&, paddle::framework::OperatorWithKernel const&, paddle::platform::Place const&, paddle::framework::AttributeMap const&)
3 paddle::platform::DeviceContextPool::Get(paddle::platform::Place const&)
4 std::__future_base::_Deferred_state<std::thread::_Invoker<std::tuple<paddle::platform::EmplaceDeviceContext<paddle::platform::CUDADeviceContext, paddle::platform::CUDAPlace>(std::map<paddle::platform::Place, std::shared_future<std::unique_ptr<paddle::platform::DeviceContext, std::default_delete<paddle::platform::DeviceContext> > >, std::less<paddle::platform::Place>, std::allocator<std::pair<paddle::platform::Place const, std::shared_future<std::unique_ptr<paddle::platform::DeviceContext, std::default_delete<paddle::platform::DeviceContext> > > > > >*, paddle::platform::Place)::{lambda()#1}> >, std::unique_ptr<paddle::platform::DeviceContext, std::default_delete<paddle::platform::DeviceContext> > >::_M_complete_async()
a8jjtwal

a8jjtwal12#

@bjjwwang 麻烦大佬再帮忙看看这个错误~~

相关问题