使用一个project里的 README.md 中的命令安装 apex:
git clone https://github.com/NVIDIA/apex cd apex pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
报错:
File "<string>", line 10, in <module> ModuleNotFoundError: No module named 'torch' error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. full command: /data/limengjie/anaconda3/envs/rfcc/bin/python /data/limengjie/anaconda3/envs/rfcc/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpznw3140d cwd: /data/limengjie/codes_flr/apex Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip.
我确定pytorch一定是可用的,问大模型解决方法,兜兜转转了很久,比如将 CUDA_PATH添加到环境变量里什么的,均不奏效。
最后是搜博客找到了官方 issues 链接,里面有个回答 https://github.com/NVIDIA/apex/issues/1852#issuecomment-2465016407 说,应该用官方文档里的命令:
I don't know if you have used the proper command. Please read README.md carefully. The proper way to compile and install apex is: pip install -v --disable-pip-version-check --no-build-isolation --no-cache-dir ./ or, for Windows: pip install -v --no-cache-dir . Please do not use something like: pip install . If you use the command given in README.md, there should be no errors. Also, this project may not be able to be compiled successfully on Windows. If possible, please use Linux.
用了一下:
pip install -v --disable-pip-version-check --no-build-isolation --no-cache-dir ./
立马成功了!
Building wheel for apex (pyproject.toml) ... done Created wheel for apex: filename=apex-0.1-py3-none-any.whl size=405312 sha256=b0d05f346c16ee12efb8b2bf75f3a5b67d58c4294242f6a7a702a954ca6861b7 Stored in directory: /tmp/pip-ephem-wheel-cache-cwyuy76k/wheels/5d/b2/b8/d302f6d579da9d24f220e1bbaa51c718f309d03effb946f807 Successfully built apex Installing collected packages: apex Successfully installed apex-0.1
教训:以后遇到问题,问大模型还是不如搜博客靠谱!
标签:wheel,named,No,apex,no,--,报错,error,pip From: https://www.cnblogs.com/hxpp/p/18670422