DeepSpeed icon indicating copy to clipboard operation
DeepSpeed copied to clipboard

[BUG]

Open ldeal3 opened this issue 2 years ago • 2 comments

Describe the bug As shown in this notebook, I run these commands: The language model I utilize is Qwen-14B, developed by Alibaba Cloud, which is a robust Transformer-based model. The software I employ is PyCharm 2023.3.1 version. Here are the encountered errors.

Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting deepspeed
  Using cached https://mirrors.aliyun.com/pypi/packages/3b/c7/c962c7515511ee4f6fe092506e303ef6973c58cfa18ff7edcebb455261b5/deepspeed-0.12.5.tar.gz (1.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      [WARNING] Unable to import torch, pre-compiling ops will be disabled. Please visit https://pytorch.org/ to see how to properly install torch on your system.
       [WARNING]  unable to import torch, please install it if you want to pre-compile any deepspeed ops.
      DS_BUILD_OPS=1
      Traceback (most recent call last):
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 147, in <module>
      AssertionError: Unable to pre-compile ops without torch installed. Please install torch before attempting to pre-compile ops.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
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.


The current state of my environment and version.

Python 3.8.0
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Wed_Feb__8_05:53:42_Coordinated_Universal_Time_2023
Cuda compilation tools, release 12.1, V12.1.66
Build cuda_12.1.r12.1/compiler.32415258_0
Name: torch
Version: 2.1.2+cu121
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: [email protected]
License: BSD-3
Location: c:\users\admin\appdata\local\programs\python\python38\lib\site-packages
Requires: filelock, fsspec, jinja2, networkx, sympy, typing-extensions
Required-by: torchaudio, torchvision

The error encountered during DeepSpeed installation suggests that PyTorch is not found prior to building the wheel (compiling the extension). This typically indicates either an incorrect or incompatible version of PyTorch installed in the Python environment.

The first thing I did was to promptly verify the PyTorch version and the CUDA version.

PyTorch version 2.1.2, compiled for CUDA 12.1,

The issue may arise from a potential discrepancy between the PyTorch version required by DeepSpeed and the version you have installed.

The code I use incorporates a variable version, making DeepSpeed adaptable to different versions of PyTorch or CUDA. To install DeepSpeed, I follow the standard method that is compatible with my existing PyTorch installation (specifically, CUDA 12.1 based PyTorch). Typically, DeepSpeed installations are done using pip. The code to be utilized is:

The outcome remains consistent with the error.

Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting deepspeed
  Using cached https://mirrors.aliyun.com/pypi/packages/3b/c7/c962c7515511ee4f6fe092506e303ef6973c58cfa18ff7edcebb455261b5/deepspeed-0.12.5.tar.gz (1.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      [WARNING] Unable to import torch, pre-compiling ops will be disabled. Please visit https://pytorch.org/ to see how to properly install torch on your system.
       [WARNING]  unable to import torch, please install it if you want to pre-compile any deepspeed ops.
      DS_BUILD_OPS=1
      Traceback (most recent call last):
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python38\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\ADMIN\AppData\Local\Temp\pip-build-env-8o1ju_6m\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 147, in <module>
      AssertionError: Unable to pre-compile ops without torch installed. Please install torch before attempting to pre-compile ops.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
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.


The conclusion remains incorrect, and there arises an issue in constructing DeepSpeed's wheel file due to the requirement of precompiling certain operations by PyTorchTo, which seems undetectable by the system.

The code is re-executed in the controller.

Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
2.1.2+cu121
>>> 

"This indicates that I have successfully verified the presence of PyTorch version 2.1.2 in my current Python environment, and it has been compiled specifically for CUDA 12.1. Despite utilizing CUDA 12.1, I am still encountering errors."

ldeal3 avatar Dec 19 '23 13:12 ldeal3

I'm having this same issue. After almost two years this is still unresolved?!

petermg avatar May 18 '25 18:05 petermg

I have suffered from the same error, but for me the missing wheel package triggered the torch error : / So maybe you check pip list | grep wheel and if it's missing just

pip install wheel==0.47.0
DS_BUILD_AIO=1 pip install -e .

JRGit4UE avatar Apr 24 '26 11:04 JRGit4UE