apex安装,解决ModuleNotFoundError: No module named ‘packaging‘ error: subprocess-exited-with-error

在anaconda上安装apex:

安装步骤:

git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --global-option="--pyprof" --global-option="--cpp_ext" --global-option="--cuda_ext" ./

报错: 

 ModuleNotFoundError: No module named 'packaging'
  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: 'D:\SOFTWARE\Anaconda\Anaconda3\envs\Dunit\python.exe' 'D:\SOFTWARE\Anaconda\Anaconda3\envs\Dunit\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' get_requires_for_build_wheel 'C:\Users\admin\AppData\Local\Temp\tmpsb751068'
  cwd: C:\Users\admin\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.

解决方法:

git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" --global-option="--deprecated_fused_adam" --global-option="--xentropy" --global-option="--fast_multihead_attn" ./

如何解决的:上GitHub进入https://github.com/NVIDIA/apex/issues/1679看别人如何解决试出来,亲测有效,常见问题上面都有!祝大家运行顺利!

你可能感兴趣的:(python,pip)