원클릭으로
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 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
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
| 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