PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.19k stars 5.57k forks source link

Paddle 2.4.0 版本 fluid/core.py 文件 import libpaddle 出错 #48667

Closed tong-zeng closed 7 months ago

tong-zeng commented 1 year ago

bug描述 Describe the Bug

Ubuntu 20.04 安装 PaddlePaddle 使用命令: conda install paddlepaddle-gpu==2.4.0 cudatoolkit=11.6 -c Paddle -c conda-forge 新建的 Conda 环境,安装脚本执行成功,但 import paddle 时报错:

>>> import paddle
Error: Can not import paddle core while this file exists: /cpfs/user/zhaochenxu1/software/anaconda3/envs/zengtong_paddle/lib/python3.9/site-packages/paddle/fluid/libpaddle.so
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/cpfs/user/zhaochenxu1/software/anaconda3/envs/zengtong_paddle/lib/python3.9/site-packages/paddle/__init__.py", line 25, in <module>
    from .framework import monkey_patch_variable
  File "/cpfs/user/zhaochenxu1/software/anaconda3/envs/zengtong_paddle/lib/python3.9/site-packages/paddle/framework/__init__.py", line 17, in <module>
    from . import random  # noqa: F401
  File "/cpfs/user/zhaochenxu1/software/anaconda3/envs/zengtong_paddle/lib/python3.9/site-packages/paddle/framework/random.py", line 16, in <module>
    import paddle.fluid as fluid
  File "/cpfs/user/zhaochenxu1/software/anaconda3/envs/zengtong_paddle/lib/python3.9/site-packages/paddle/fluid/__init__.py", line 36, in <module>
    from . import framework
  File "/cpfs/user/zhaochenxu1/software/anaconda3/envs/zengtong_paddle/lib/python3.9/site-packages/paddle/fluid/framework.py", line 37, in <module>
    from . import core
  File "/cpfs/user/zhaochenxu1/software/anaconda3/envs/zengtong_paddle/lib/python3.9/site-packages/paddle/fluid/core.py", line 304, in <module>
    raise e
  File "/cpfs/user/zhaochenxu1/software/anaconda3/envs/zengtong_paddle/lib/python3.9/site-packages/paddle/fluid/core.py", line 249, in <module>
    from . import libpaddle
ImportError: libpython3.9.so.1.0: cannot open shared object file: No such file or directory

测试了 Python 3.9, Python 3.10 版本,都会出现类似错误。

nvcc 版本:

Cuda compilation tools, release 11.6, V11.6.55
Build cuda_11.6.r11.6/compiler.30794723_0

Pytorch 安装 cudatoolkit=11.6 版本可以正常运行。

其他补充信息 Additional Supplementary Information

No response

paddle-bot[bot] commented 1 year ago

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网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!

tong-zeng commented 1 year ago

可以通过把 libpython3.9.so.1.0 这个文件复制到 /usr/lib 目录临时解决 libpython3.9.so.1.0 这个文件在 /your/anaconda_home/envs/your_environment_name/lib 目录下 cp /your/anaconda_home/envs/your_environment_name/lib/libpython3.9.so.1.0 /usr/lib

yongshangli commented 1 year ago

I got the same error. Exactly the same.

Freshield commented 1 year ago

Get same error in Python3.9 both conda install and pip install

icedream2linxi commented 1 year ago

这个问题在 2.4.2 下依然存在。 我猜测原因大概率是 libpaddle.so 的 RPATH 设置不对,缺少 $ORIGIN/../lib/。 https://docs.conda.io/projects/conda-build/en/stable/resources/use-shared-libraries.html

paddle-bot[bot] commented 7 months ago

Since you haven\'t replied for more than a year, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. 由于您超过一年未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。