بنقرة واحدة
torch-npu-pyyaml-preinstall
Pre-install PyYAML to prevent torch-npu transitive dependency failure
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Pre-install PyYAML to prevent torch-npu transitive dependency failure
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Replace NVIDIA Apex (apex_C) with NPU-native alternatives
System-site-packages venv strategy eliminates CUDA variant downloads on pre-configured Ascend hosts
Set up torch-npu virtual environment with CPU-base torch and +cpu variant torchvision
استنادا إلى تصنيف SOC المهني
| name | torch-npu-pyyaml-preinstall |
| description | Pre-install PyYAML to prevent torch-npu transitive dependency failure |
| tags | ["torch-npu","pyyaml","transitive-dependency","undeclared-requirement","dependency_issue"] |
| category | dependency_issue |
| subtype | undeclared_transitive_dependency |
| confidence | 0.95 |
| occurrence_count | 1 |
torch-npu 2.5.1's memory visualization submodule (torch_npu/npu/_memory_viz.py) imports yaml unconditionally at module load time. However, PyYAML is not declared in torch-npu's pip metadata (requires field), so a fresh virtual environment with only torch-npu installed will lack it. The error is misleading because the traceback originates from import torch (not import torch_npu), making the actual missing dependency hard to diagnose.
pip install PyYAML (use domestic mirror if needed: pip install PyYAML -i https://mirrors.aliyun.com/pypi/simple/).python -c 'import torch_npu; import torch_npu.npu' — if this exits cleanly without ModuleNotFoundError, the dependency is resolved.python -c 'import yaml; print(yaml.__version__)'.File: requirements.txt
torch torch-npu torchvision
torch torch-npu torchvision PyYAML