Open nongdaxiaofeng opened 1 year ago
去修改aistudio上该项目的paddle环境,即在项目主界面的右边有“删除” “修改” “设置为公开”那里, 点击修改, 把通用框架修改为paddle 2.4.0版本或以上,保存,即可修复该import问题。
原因我猜是paddle新版的api兼容性问题,参考issue:import error
经测试,最新版本的pgl运行模型会报bug,参见issueValueError: (InvalidArgument) argument (position 2) must be list of int, but got memmap at pos 0,建议是指定安装版本pip install pgl==2.2.4,paddle版本需2.2.0及以上即可
pip install pgl==2.2.4 Looking in indexes: http://mirrors.aliyun.com/pypi/simple ERROR: Could not find a version that satisfies the requirement pgl==2.2.4 (from versions: 2.2.3) ERROR: No matching distribution found for pgl==2.2.4 不知道为什么装不了2.2.4
ImportError Traceback (most recent call last) /tmp/ipykernel_227/4261471993.py in
----> 1 import pgl
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/init.py in
25 % paddle.version)
26
---> 27 from pgl import graph
28 from pgl import graph_kernel
29 from pgl import math
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/graph.py in
28
29 import pgl
---> 30 from pgl.utils import op
31 import pgl.graph_kernel as graph_kernel
32 from pgl.message import Message
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/utils/op.py in
17 """
18 import paddle
---> 19 from paddle import _C_ops, _legacy_C_ops
20 import numpy as np
21 from pgl.utils.helper import check_is_tensor
ImportError: cannot import name '_legacy_C_ops' from 'paddle' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/init.py)