microsoft / DeepSpeed

DeepSpeed is a deep learning optimization library that makes distributed training and inference easy, efficient, and effective.
https://www.deepspeed.ai/
Apache License 2.0
33.6k stars 3.94k forks source link

AssertionError: Unable to pre-compile ops without torch installed. Please install torch before attempting to pre-compile ops. #5663

Open nitinmukesh opened 2 weeks ago

nitinmukesh commented 2 weeks ago

Environment: Windows 11

(venv) C:\sd\HunyuanDiT>pip install deepspeed==0.6.3
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting deepspeed==0.6.3
  Downloading deepspeed-0.6.3.tar.gz (554 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 554.6/554.6 kB 11.6 MB/s eta 0:00:00
  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:\sd\HunyuanDiT\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\sd\HunyuanDiT\venv\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:\sd\HunyuanDiT\venv\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\nitin\AppData\Local\Temp\pip-build-env-9vra48g9\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\nitin\AppData\Local\Temp\pip-build-env-9vra48g9\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\nitin\AppData\Local\Temp\pip-build-env-9vra48g9\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Users\nitin\AppData\Local\Temp\pip-build-env-9vra48g9\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 118, 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.
(venv) C:\sd\HunyuanDiT>python -c "import torch; print('torch:', torch.__version__, torch)"
torch: 2.0.1+cu117 <module 'torch' from 'C:\\sd\\HunyuanDiT\\venv\\lib\\site-packages\\torch\\__init__.py'>

(venv) C:\sd\HunyuanDiT>python -c "import torch; print('CUDA available:', torch.cuda.is_available())"
CUDA available: True

PIP LIST

(venv) C:\sd\HunyuanDiT>pip list
Package                   Version
------------------------- ------------
accelerate                0.29.3
aiofiles                  23.2.1
altair                    5.3.0
annotated-types           0.7.0
anyio                     4.4.0
attrs                     23.2.0
certifi                   2022.12.7
charset-normalizer        2.1.1
click                     8.1.7
colorama                  0.4.6
coloredlogs               15.0.1
contourpy                 1.2.1
cuda-python               11.7.1
cycler                    0.12.1
Cython                    3.0.10
diffusers                 0.21.2
dnspython                 2.6.1
einops                    0.7.0
email_validator           2.1.1
exceptiongroup            1.2.1
fastapi                   0.111.0
fastapi-cli               0.0.4
ffmpy                     0.3.2
filelock                  3.13.1
flatbuffers               24.3.25
fonttools                 4.53.0
fsspec                    2024.6.0
gradio                    3.50.2
gradio_client             0.6.1
h11                       0.14.0
httpcore                  1.0.5
httptools                 0.6.1
httpx                     0.27.0
huggingface-hub           0.23.4
humanfriendly             10.0
idna                      3.4
importlib_metadata        7.1.0
importlib_resources       6.4.0
Jinja2                    3.1.3
jsonschema                4.22.0
jsonschema-specifications 2023.12.1
kiwisolver                1.4.5
loguru                    0.7.2
markdown-it-py            3.0.0
MarkupSafe                2.1.5
matplotlib                3.9.0
mdurl                     0.1.2
mpmath                    1.3.0
networkx                  3.2.1
numpy                     1.26.3
onnx                      1.12.0
onnx-graphsurgeon         0.3.27
onnxruntime               1.12.1
orjson                    3.10.5
packaging                 24.1
pandas                    2.0.3
peft                      0.10.0
pillow                    10.2.0
pip                       24.0
polygraphy                0.47.1
protobuf                  3.19.0
psutil                    5.9.8
pydantic                  2.7.4
pydantic_core             2.18.4
pydub                     0.25.1
Pygments                  2.18.0
pyparsing                 3.1.2
pyreadline3               3.4.1
python-dateutil           2.9.0.post0
python-dotenv             1.0.1
python-multipart          0.0.9
pytz                      2024.1
PyYAML                    6.0.1
referencing               0.35.1
regex                     2024.5.15
requests                  2.28.1
rich                      13.7.1
rpds-py                   0.18.1
safetensors               0.4.3
semantic-version          2.10.0
sentencepiece             0.1.99
setuptools                63.2.0
shellingham               1.5.4
six                       1.16.0
sniffio                   1.3.1
starlette                 0.37.2
sympy                     1.12
timm                      0.9.5
tokenizers                0.15.2
toolz                     0.12.1
torch                     2.0.1+cu117
torchaudio                2.0.2+cu117
torchvision               0.15.2+cu117
tqdm                      4.66.4
transformers              4.39.1
typer                     0.12.3
typing_extensions         4.9.0
tzdata                    2024.1
ujson                     5.10.0
urllib3                   1.26.13
uvicorn                   0.30.1
watchfiles                0.22.0
websockets                11.0.3
win32-setctime            1.1.0
zipp                      3.19.2
(venv) C:\sd\HunyuanDiT>python --version
Python 3.10.6

Please let me know if any other information is required

loadams commented 1 week ago

Hi @nitinmukesh - we are working on DeepSpeed for Windows support, but at least right now, you will either need to install via the build_win.bat script or using wsl to install via pip.

nitinmukesh commented 1 week ago

@loadams Thanks for the update. I was a little surprised: a project by Microsoft is not supported on Windows or too complex to install as compared to Linux.

As you can understand there is so much growth in AI tools and some are using this library. Unfortunately Windows users are missing out because of this library.

I will wait for the Windows support, thank you.

loadams commented 4 days ago

Hi @nitinmukesh,

The current install options on Windows are different than Linux, and though we are working towards better support, for now you'll need to use the Windows installation instructions and the build_win.bat. We have other older open GH issues that track Windows support so I'll close this for now if that's okay with you?

nitinmukesh commented 16 hours ago

Hello @loadams

If you are not planning to support Windows in near future then yes you can close this as Won't fix or you can link the issues so they can be easily tracked. The older issues don't appear easily on search and that's why I logged this.

As you can see in some other threads, those other option does not work (atleast not for everyone) https://github.com/microsoft/DeepSpeed/issues/5698

I would request to look into this issue on priority.

costin-eseanu commented 16 hours ago

Hi @nitinmukesh,

We are working on creating a Windows specific wheel for deepspeed. The alternative today is to build the package from source, using the previously mentioned build_win.bat.

nitinmukesh commented 2 hours ago

@costin-eseanu Thanks for the update. I guess this issue will be fixed with Windows specific wheel.