deepspeedai / deepspeedai/DeepSpeed
[BUG] Installation doesn't work (Unable to import torch, pre-compiling ops will be disabled.)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 43.1k
- Forks
- 5k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 112
Description
Describe the bug
I can't install deepspeed using "pip install deepspeed". It says that I don't have pytorch, eventhough I have pytorch.
To Reproduce
Steps to reproduce the behavior:
- Install python 3.10.11
- Check your python version
D:\IA\DeepSpeed>python --version
Python 3.10.11
- Create a venv
D:\IA\DeepSpeed>python -m venv venv
- Activate the venv
D:\IA\DeepSpeed>venv\Scripts\activate
- Upgrade pip (important, or else it won't install pytorch)
(venv) D:\IA\DeepSpeed>python -m pip install --upgrade pip
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Requirement already satisfied: pip in d:\ia\deepspeed\venv\lib\site-packages (23.0.1)
Collecting pip
Downloading pip-25.1.1-py3-none-any.whl (1.8 MB)
---------------------------------------- 1.8/1.8 MB 38.6 MB/s eta 0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 23.0.1
Uninstalling pip-23.0.1:
Successfully uninstalled pip-23.0.1
Successfully installed pip-25.1.1
- Install pytorch 2.7.0 with cuda 12.8
(venv) D:\IA\DeepSpeed>pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
Looking in indexes: https://download.pytorch.org/whl/cu128, https://pypi.ngc.nvidia.com
Collecting torch
Downloading https://download.pytorch.org/whl/cu128/torch-2.7.0%2Bcu128-cp310-cp310-win_amd64.whl.metadata (29 kB)
Collecting torchvision
Downloading https://download.pytorch.org/whl/cu128/torchvision-0.22.0%2Bcu128-cp310-cp310-win_amd64.whl.metadata (6.3 kB)
Collecting torchaudio
Downloading https://download.pytorch.org/whl/cu128/torchaudio-2.7.0%2Bcu128-cp310-cp310-win_amd64.whl.metadata (6.8 kB)
Collecting filelock (from torch)
Downloading https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
Collecting typing-extensions>=4.10.0 (from torch)
Downloading https://download.pytorch.org/whl/typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting sympy>=1.13.3 (from torch)
Downloading https://download.pytorch.org/whl/sympy-1.13.3-py3-none-any.whl.metadata (12 kB)
Collecting networkx (from torch)
Downloading https://download.pytorch.org/whl/networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
Collecting jinja2 (from torch)
Downloading https://download.pytorch.org/whl/Jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting fsspec (from torch)
Downloading https://download.pytorch.org/whl/fsspec-2024.6.1-py3-none-any.whl.metadata (11 kB)
Collecting numpy (from torchvision)
Downloading https://download.pytorch.org/whl/numpy-2.1.2-cp310-cp310-win_amd64.whl.metadata (59 kB)
Collecting pillow!=8.3.*,>=5.3.0 (from torchvision)
Downloading https://download.pytorch.org/whl/pillow-11.0.0-cp310-cp310-win_amd64.whl.metadata (9.3 kB)
Collecting mpmath<1.4,>=1.1.0 (from sympy>=1.13.3->torch)
Downloading https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB)
---------------------------------------- 536.2/536.2 kB ? eta 0:00:00
Collecting MarkupSafe>=2.0 (from jinja2->torch)
Downloading https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp310-cp310-win_amd64.whl (17 kB)
Downloading https://download.pytorch.org/whl/cu128/torch-2.7.0%2Bcu128-cp310-cp310-win_amd64.whl (3338.3 MB)
---------------------------------------- 3.3/3.3 GB 77.6 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/cu128/torchvision-0.22.0%2Bcu128-cp310-cp310-win_amd64.whl (7.6 MB)
---------------------------------------- 7.6/7.6 MB 79.3 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/cu128/torchaudio-2.7.0%2Bcu128-cp310-cp310-win_amd64.whl (4.7 MB)
---------------------------------------- 4.7/4.7 MB 93.4 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/pillow-11.0.0-cp310-cp310-win_amd64.whl (2.6 MB)
---------------------------------------- 2.6/2.6 MB 144.0 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/sympy-1.13.3-py3-none-any.whl (6.2 MB)
---------------------------------------- 6.2/6.2 MB 47.4 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Downloading https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl (11 kB)
Downloading https://download.pytorch.org/whl/fsspec-2024.6.1-py3-none-any.whl (177 kB)
Downloading https://download.pytorch.org/whl/Jinja2-3.1.4-py3-none-any.whl (133 kB)
Downloading https://download.pytorch.org/whl/networkx-3.3-py3-none-any.whl (1.7 MB)
---------------------------------------- 1.7/1.7 MB 90.0 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/numpy-2.1.2-cp310-cp310-win_amd64.whl (12.9 MB)
---------------------------------------- 12.9/12.9 MB 53.6 MB/s eta 0:00:00
Installing collected packages: mpmath, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, fsspec, filelock, jinja2, torch, torchvision, torchaudio
Successfully installed MarkupSafe-2.1.5 filelock-3.13.1 fsspec-2024.6.1 jinja2-3.1.4 mpmath-1.3.0 networkx-3.3 numpy-2.1.2 pillow-11.0.0 sympy-1.13.3 torch-2.7.0+cu128 torchaudio-2.7.0+cu128 torchvision-0.22.0+cu128 typing-extensions-4.12.2
- Here is my environnement:
(venv) D:\IA\DeepSpeed>pip list
Package Version
----------------- ------------
filelock 3.13.1
fsspec 2024.6.1
Jinja2 3.1.4
MarkupSafe 2.1.5
mpmath 1.3.0
networkx 3.3
numpy 2.1.2
pillow 11.0.0
pip 25.1.1
setuptools 65.5.0
sympy 1.13.3
torch 2.7.0+cu128
torchaudio 2.7.0+cu128
torchvision 0.22.0+cu128
typing_extensions 4.12.2
- Check that pytorch is properly installed
(venv) D:\IA\DeepSpeed>python
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'2.7.0+cu128'
>>> torch.cuda.is_available()
True
>>> exit()
- Install deepspeed using pip
(venv) D:\IA\DeepSpeed>pip install deepspeed
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting deepspeed
Downloading deepspeed-0.16.7.tar.gz (1.5 MB)
---------------------------------------- 1.5/1.5 MB 40.3 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.
←[93m [WARNING] ←[0m 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 "D:\IA\DeepSpeed\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
main()
File "D:\IA\DeepSpeed\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
File "D:\IA\DeepSpeed\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\Armaguedin\AppData\Local\Temp\pip-build-env-e2l_hvis\overlay\Lib\site-packages\setuptools\build_meta.py", line 331, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
File "C:\Users\Armaguedin\AppData\Local\Temp\pip-build-env-e2l_hvis\overlay\Lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires
self.run_setup()
File "C:\Users\Armaguedin\AppData\Local\Temp\pip-build-env-e2l_hvis\overlay\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup
super().run_setup(setup_script=setup_script)
File "C:\Users\Armaguedin\AppData\Local\Temp\pip-build-env-e2l_hvis\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup
exec(code, locals())
File "<string>", line 157, 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.
Expected behavior
No error
ds_report output
ds_report doesn't work since deepseek installation failed.
Screenshots
If applicable, add screenshots to help explain your problem.
System info
- OS: Windows 10 Pro
- GPU count and types: A single RTX 5090
- No interconnection
- Python 3.10.11
- Driver Version: 572.83
- CUDA Version: 12.8
Additional informations
I tried to install deepspeed manually but it quickly failed (developer command prompt is running in administrator)
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.12.2
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
C:\Windows\System32>D:
D:\>cd ia
D:\IA>cd DeepSpeed
D:\IA\DeepSpeed>venv\Scripts\activate
(venv) D:\IA\DeepSpeed>build_win.bat
D:\IA\DeepSpeed\venv\Scripts\python.exe: No module named build
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The report's entry points are pip install deepspeed and build_win.bat; begin by reproducing the Python 3.10.11/Windows virtual-environment installation and compare the successful torch import with the build output. Done means deepspeed installs without the torch assertion, and the Windows build path no longer stops with the reported missing build module.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- build-system, machine-learning, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100