已合并
docs: example样例README补充运行所需Python依赖包清单与缺失排查指引 #655
yelongjian创建于 10 天前
docs: example样例README补充运行所需Python依赖包清单与缺失排查指引 #655
已合并
yelongjian创建于 10 天前
yelongjian成员
10 天前

Pull Request

描述

修复 example 样例在裸环境的 Python 依赖断链问题(Ascend 910C + CANN 9.3.0~weekly 环境反馈):

问题:新手按文档装好 CANN 并编译 metadef 后运行 example/run_example.sh,样例约 10 秒退出(RC=255),stdout 仅两行 INFO 日志(失败与成功分支同格式,无错误码),真因藏于 ~/ascend/log/debug/plog/ 深层日志:GE 初始化时 TBE 等算子编译组件逐层 import 系统外 Python 包,依次报 No module named 'numpy' → 'decorator' → 'sympy' → 'scipy' → 'attr' → 'psutil',每装一个重跑撞下一个,需多轮试错才能跑通;而全文档对所需 Python 依赖零声明(grep numpy/sympy/scipy/psutil/decorator 零命中,attrs 仅误中 C++ RuntimeAttrs API 文档)。多次独立评估(不同日期)稳定复现,依赖缺失链首个模块恒为 numpy。

依据(依赖清单非猜测):

  • CANN toolkit 自带 Python 包 asc_op_compile_base 的 METADATA 正式声明 Requires-Dist: numpy / decorator / attrs / psutil
  • toolkit tbe/tvm 组件源码 import sympy / scipy(GE 初始化加载 TBE 时触发)

说明:反馈中的另两点(①文档无样例入口链接、③example/ 命名误导)已由先前合入的 example/README.md 及 README/quick_install 入口链接解决,本 PR 补齐剩余缺口②——显式依赖声明。

修改:example/README.md / example/README_en.md

  1. 『前提条件』Python 依赖条目补充显式安装命令 pip3 install numpy decorator sympy scipy attrs psutil,并说明缺失时的失败现象(RC=255、stdout 无明显报错、plog 出现 No module named 'xxx');
  2. 『结果判定与排查』运行失败步骤补充:plog 出现 No module named 'xxx' 即为 Python 依赖缺失,按前提条件安装后重试。

变更类型

关联的Issue

无

如何测试

  1. 文档变更,无代码逻辑影响;markdown 渲染检查两处 README 中英对照一致
  2. 依赖清单核验:grep Requires-Dist ${ASCEND_HOME_PATH}/python/site-packages/asc_op_compile_base-*.dist-info/METADATA 输出 numpy/decorator/attrs/psutil;grep -rl "import sympy\|import scipy" ${ASCEND_HOME_PATH}/python/site-packages/tbe/ 命中 tvm 组件源码
  3. 裸环境(无上述 Python 包的容器)运行 bash example/run_example.sh,plog 中首个缺失模块为 numpy,按 README 新增命令一次性安装后依赖链不再阻塞

核对清单

其他信息

无

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 yelongjian 的贡献)
Yyelongjian成员
10 天前 创建了 pull request,commit ab421bb3
atomgit-bot
atomgit-bot
10 天前 评论:

变更摘要

本 PR 为 example/README.md 与 example/README_en.md 补充运行样例所需的 Python 依赖声明。针对裸环境(非 CANN 官方镜像)中因缺少 numpy、decorator、sympy、scipy、attrs、psutil 等包导致样例以退出码 255 静默失败的问题,在「前提条件」中给出显式 pip3 install 命令与失败现象描述,并在「结果判定与排查」中增加对应排查指引,中英文文档保持同步。

主要改动

  • 补充 Python 依赖安装清单:前提条件条目新增 pip3 install numpy decorator sympy scipy attrs psutil 命令,明确 GE 运行期加载算子编译组件时会逐层 import 这些包,并说明官方 CANN 容器镜像已默认具备、可跳过此步骤。
  • 描述依赖缺失的失败现象:说明自主搭建的裸环境通常缺少上述依赖,缺失时样例运行失败表现为退出码 255、stdout 无明显报错、plog 日志出现 No module named 'xxx'。
  • 完善运行失败排查步骤:在「结果判定与排查」第 3 步补充判断规则——plog 中出现 No module named 'xxx' 即判定为 Python 依赖缺失,需按「前提条件」安装对应包后重试。
  • 中英文文档同步更新:example/README_en.md 以对应的英文表述同步新增依赖安装命令、失败现象与排查指引,保证两份 README 内容一致。
likedislike
不准确?
atomgit-bot
atomgit-bot
10 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
10 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
10 天前 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/metadef ✅ yangyongqiang0606, kobemini (2/2) ✅ yangyongqiang0606 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

yelongjian, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robot
CANN-robot成员
10 天前 评论:

CLA Signature Pass

yelongjian, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
10 天前 将yangyongqiang0606,kobemini,du-hua1024,tangqunzhang,depeng1994,wqtshg_wt,peiyang,shengnan666,zhanj,zhujingjing,Mexyy,wangxiaotian995设为评审人
CANN-robotCANN-robot成员
10 天前 将yangyongqiang0606,kobemini,du-hua1024,tangqunzhang,depeng1994,wqtshg_wt,peiyang,shengnan666,zhanj,zhujingjing,Mexyy,wangxiaotian995设为审查人
yelongjian成员
10 天前 评论:

compile

likedislike
Yyelongjian成员
10 天前 预合并成功(commit_id: 50d534e570cd884fd7770f2b345806c02a3692ba)
CANN-robot
CANN-robot成员
10 天前 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
10 天前 添加了label:ci-pipeline-running
此处折叠了8条事件消息 查看更多
CANN-robotCANN-robot成员
10 天前 删除了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
10 天前 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci-pipeline-passed.

likedislike
yelongjian成员
10 天前 评论:

compile

likedislike
Yyelongjian成员
10 天前 预合并成功(commit_id: e483eb54dcf871b7ef9828f54a005e6c6c838aa4)
CANN-robot
CANN-robot成员
10 天前 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
10 天前 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
10 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
10 天前 添加了label:ci-pipeline-passed
GengChao
GengChao成员
10 天前 评论:

/lgtm

likedislike
yangyongqiang
yangyongqiang成员
10 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
10 天前 添加了label:lgtm
yangyongqiang
yangyongqiang成员
10 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
10 天前 添加了label:approved
CANN-robotCANN-robot成员
10 天前 合入了pull request