conda环境下Python报错:raise MissingCUDAException("CUDA_HOME does not exist, unable to compile CUDA op(s)") CUDA_HOME does not exist, unable to compile CUDA op(s)

发布时间 2023-12-02 10:33:12作者: Angry_Panda

conda环境下Python报错:

(pytorch) devil@Monster:~$ pip install deepspeed

Collecting deepspeed
  Using cached deepspeed-0.12.4.tar.gz (1.2 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ?─> [10 lines of output]
      [2023-12-02 10:26:18,900] [INFO] [real_accelerator.py:161:get_accelerator] Setting ds_accelerator to cuda (auto detect)
      [2023-12-02 10:26:19,103] [INFO] [real_accelerator.py:161:get_accelerator] Setting ds_accelerator to cuda (auto detect)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-dau7qb6n/deepspeed_09ce1e6647ff4db9be233fc65e5f4b88/setup.py", line 100, in <module>
          cuda_major_ver, cuda_minor_ver = installed_cuda_version()
        File "/tmp/pip-install-dau7qb6n/deepspeed_09ce1e6647ff4db9be233fc65e5f4b88/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

× Encountered error while generating package metadata.
?─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

 

 

 

 

 

解决方法:

conda install cuda-nvcc

 

 

 

 

 

 

---------------------------------------