pip install deepspeed 报错

1,587 阅读1分钟

报错信息

(py39) root@xyj-test-202c0f98aaf54d73a79ed3516aa8f6e3:/mnt/admin/ChatGLM3/finetune_demo# pip install deepspeed==0.13.1
Collecting deepspeed==0.13.1
  Downloading deepspeed-0.13.1.tar.gz (1.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 18.5 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-z_oioy_2/deepspeed_2063b2f959a649b194c496173488171a/setup.py", line 100, in <module>
          cuda_major_ver, cuda_minor_ver = installed_cuda_version()
        File "/tmp/pip-install-z_oioy_2/deepspeed_2063b2f959a649b194c496173488171a/op_builder/builder.py", line 50, in installed_cuda_version
          raise MissingCUDAException("CUDA_HOME does not exist, unable to compile CUDA op(s)")
      op_builder.builder.MissingCUDAException: CUDA_HOME does not exist, unable to compile CUDA op(s)
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

问题描述

根据错误信息来看,环境变量 CUDA_HOME 没有设置正确

解决方法

  1. 先卸载之前安装的依赖包 pip uninstall -r requirements -y
  2. 安装 deepspeed 包 pip install deepspeed -i https://pypi.tuna.tsinghua.edu.cn/simple
  3. 再安装项目依赖包 pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

总结

依赖包安装的先后顺序会有影响,需要先安装 deepspeed 包