fix: 补充requirements依赖声明,拆分构建期与运行期依赖

Co-authored-by: mhy<mahongyu7@huawei.com>



# message auto-generated for no-merge-commit merge:
!45566 merge deps/requirements-restructure into master

fix: 补充requirements依赖声明,拆分构建期与运行期依赖

Created-by: m0_64341872
Commit-by: mhy
Merged-by: ascend-robot
Description: <!--
PR描述模板更新日期:20260203
-->

# 【合入来源】
> <font color="red">**如有社区issue,请关联issue链接**</font>\
> <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font>

- [x] 需求
- [ ] 问题单
- [ ] issue/工单
- [ ] 重构优化
- [ ] 资料更新

# 【修改方案】
> 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\
> 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)

1. 新建 requirements-build.txt,拆出构建期工具依赖(pyyaml、setuptools),三个版本变体共用一份,因为这两个包不随 torch 版本变化
2. requirements.txt / requirements_2.13.txt / requirements_2.15.txt 开头通过 `-r requirements-build.txt` 引用上述文件;同时补充声明 numpy、sympy、typing-extensions 三个依赖——这三个包在 contrib/、profiler/、_inductor/ 中被无条件 import,但此前在任何依赖文件中均未声明
3. setup.py 的 install_requires 同步补充上述三个依赖,确保 pip install 生成的 wheel 依赖清单完整(这是唯一真正被 pip 强制执行、随 wheel 发布给用户的清单)
# 【资料变更】
> 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及”

不涉及
# 【接口变更】
> 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及”

不涉及
# 【功能验证】
> 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\
> 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

# 【CheckList】
> PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

- [x] 代码注释完备,正确记录错误日志
- [x] 代码实现进行了返回值、空指针等校验
- [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
- [x] PR持续集成流水线(CI)执行通过,代码检查无异常


See merge request: Ascend/pytorch!45566
This commit is contained in:
m0_64341872
2026-09-17 11:07:55 +08:00
committed by ascend-robot
parent b3fbaac664
commit 1b64dadd89
10 changed files with 97 additions and 47 deletions
+12
View File
@@ -0,0 +1,12 @@
--extra-index-url https://download.pytorch.org/whl/nightly/cpu
pyyaml>=6.0.3
typing-extensions>=4.10.0
setuptools>=81.0.0
wheel>=0.45.1
cmake>=3.18.4.post1
numpy>=1.26.4
ninja
auditwheel>=5.4.0
torch==2.15.0.dev20260902+cpu
+11 -5
View File
@@ -1,7 +1,13 @@
--extra-index-url https://download.pytorch.org/whl/nightly/cpu
pyyaml
setuptools
auditwheel
# Build System requirements
-r requirements-build.txt
torch==2.15.0.dev20260902+cpu
--extra-index-url https://download.pytorch.org/whl/nightly/cpu
sympy>=1.13.3
expecttest>=0.1.3
transformers>=4.40.0
torchvision>=0.30.0.dev20260902
requests>=2.32.0
Pillow>=10.3.0
+12
View File
@@ -0,0 +1,12 @@
--extra-index-url https://download.pytorch.org/whl/cpu
pyyaml>=6.0.3
typing-extensions>=4.10.0
setuptools>=81.0.0
wheel>=0.45.1
cmake>=3.18.4.post1
numpy>=1.26.4
ninja
auditwheel>=5.4.0
torch==2.13.0+cpu
+11 -5
View File
@@ -1,7 +1,13 @@
--extra-index-url https://download.pytorch.org/whl/cpu
pyyaml
setuptools
auditwheel
# Build System requirements
-r requirements_2.13-build.txt
torch==2.13.0+cpu
--extra-index-url https://download.pytorch.org/whl/cpu
sympy>=1.13.3
expecttest>=0.1.3
transformers>=4.40.0
torchvision>=0.28.0
requests>=2.32.0
Pillow>=10.3.0
+12
View File
@@ -0,0 +1,12 @@
--extra-index-url https://download.pytorch.org/whl/cpu
pyyaml>=6.0.3
typing-extensions>=4.10.0
setuptools>=81.0.0
wheel>=0.45.1
cmake>=3.18.4.post1
numpy>=1.26.4
ninja
auditwheel>=5.4.0
torch==2.14.0+cpu
+11 -5
View File
@@ -1,7 +1,13 @@
--extra-index-url https://download.pytorch.org/whl/cpu
pyyaml
setuptools
auditwheel
# Build System requirements
-r requirements_2.14-build.txt
torch==2.14.0+cpu
--extra-index-url https://download.pytorch.org/whl/cpu
sympy>=1.13.3
expecttest>=0.1.3
transformers>=4.40.0
torchvision>=0.29.0
requests>=2.32.0
Pillow>=10.3.0
+2
View File
@@ -782,6 +782,8 @@ setup(
],
install_requires=[
*_get_torch_requires(),
'numpy',
'pyyaml',
],
extras_require={
},
-2
View File
@@ -1,10 +1,8 @@
--extra-index-url https://download.pytorch.org/whl/nightly/cpu
coverage
beartype==0.17.0
expecttest==0.1.3
hypothesis
mypy==1.16.0
numpy==1.26.4
onnx==1.21.0
onnxruntime==1.23.1
+13 -15
View File
@@ -1,20 +1,18 @@
--extra-index-url https://download.pytorch.org/whl/cpu
coverage
beartype==0.17.0
expecttest==0.1.3
expecttest>=0.1.3
hypothesis
mypy==1.16.0
numpy==1.26.4
onnx==1.21.0
onnxruntime==1.23.1
onnx-ir==0.1.16
onnxscript==0.6.2
Pillow==10.3.0
requests==2.32.0
transformers==4.40.0
pytest==8.3.2
parameterized==0.9.0
numpy>=1.26.4
onnx>=1.21.0
onnxruntime>=1.23.1
onnx-ir>=0.1.16
onnxscript>=0.6.2
Pillow>=10.3.0
requests>=2.32.0
transformers>=4.40.0
pytest>=8.3.2
parameterized>=0.9.0
torchvision==0.28.0
ml-dtypes==0.5.1
protobuf==6.33.5
ml-dtypes>=0.5.1
protobuf>=6.33.5
+13 -15
View File
@@ -1,20 +1,18 @@
--extra-index-url https://download.pytorch.org/whl/cpu
coverage
beartype==0.17.0
expecttest==0.1.3
expecttest>=0.1.3
hypothesis
mypy==1.16.0
numpy==1.26.4
onnx==1.21.0
onnxruntime==1.23.1
onnx-ir==0.1.16
onnxscript==0.6.2
Pillow==10.3.0
requests==2.32.0
transformers==4.40.0
pytest==8.3.2
parameterized==0.9.0
numpy>=1.26.4
onnx>=1.21.0
onnxruntime>=1.23.1
onnx-ir>=0.1.16
onnxscript>=0.6.2
Pillow>=10.3.0
requests>=2.32.0
transformers>=4.40.0
pytest>=8.3.2
parameterized>=0.9.0
torchvision==0.29.0
ml-dtypes==0.5.1
protobuf==6.33.5
ml-dtypes>=0.5.1
protobuf>=6.33.5