DeepSpeed icon indicating copy to clipboard operation
DeepSpeed copied to clipboard

[BUG] Install to Windows - fatal error LNK1181

Open lokanaft opened this issue 7 months ago • 3 comments

When I try to run build_win.bat in "Developer Command Promt for VS 2022", I can see errors about "LINK : fatal error LNK1181". When I run build_win.bat in any other console, the result is the same, but it doesn't even say which file was not found.

Windows 10, RTX 5080, now PyTorch 2.7, CUDA 12.8 - try different combination

C:\Users\admin\Desktop\HunyuanVideo_I2V\DeepSpeed>C:\Users\admin\Desktop\HunyuanVideo_I2V\DeepSpeed\build_win.bat
* Getting build dependencies for wheel...
DS_BUILD_OPS=1
test.c
LINK : fatal error LNK1181: не удается открыть входной файл "aio.lib"
test.c
LINK : fatal error LNK1181: не удается открыть входной файл "cufile.lib"
Install Ops={'async_io': False, 'fused_adam': 1, 'cpu_adam': 1, 'cpu_adagrad': 1, 'cpu_lion': 1, 'dc': False, 'evoformer_attn': False, 'fp_quantizer': False, 'fused_lamb': 1, 'fused_lion': 1, 'gds': False, 'transformer_inference': 1, 'inference_core_ops': 1, 'cutlass_ops': False, 'quantizer': 1, 'ragged_device_ops': False, 'ragged_ops': 1, 'random_ltd': 1, 'sparse_attn': False, 'spatial_inference': 1, 'transformer': 1, 'stochastic_transformer': 1}
Traceback (most recent call last):
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
    main()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 373, in main
    json_out["return_val"] = hook(**hook_input["kwargs"])
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel
    return hook(config_settings)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\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\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires
    self.run_setup()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup
    super().run_setup(setup_script=setup_script)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup
    exec(code, locals())
  File "<string>", line 210, in <module>
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] Не удается найти указанный файл

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel

lokanaft avatar May 09 '25 14:05 lokanaft

@lokanaft - can you share your python version? And can you specify a DeepSpeed version, preferably 0.16.4 if you can since I've well tested that one.

loadams avatar May 19 '25 16:05 loadams

I've got the same output. Microsoft Visual Studio 2022 Community is installed, including the C++ components.

The following is the output when run from the x64 Native Tools Command Prompt for VS 2022:

E:\git\extern\DeepSpeed>build_win.bat
* Getting build dependencies for wheel...
DS_BUILD_OPS=1
test.c
LINK : fatal error LNK1181: cannot open input file 'aio.lib'
test.c
LINK : fatal error LNK1181: cannot open input file 'cufile.lib'
Install Ops={'async_io': False, 'fused_adam': 1, 'cpu_adam': 1, 'cpu_adagrad': 1, 'cpu_lion': 1, 'dc': False, 'evoformer_attn': False, 'fp_quantizer': False, 'fused_lamb': 1, 'fused_lion': 1, 'gds': False, 'transformer_inference': 1, 'inference_core_ops': 1, 'cutlass_ops': False, 'quantizer': 1, 'ragged_device_ops': False, 'ragged_ops': 1, 'random_ltd': 1, 'sparse_attn': False, 'spatial_inference': 1, 'transformer': 1, 'stochastic_transformer': 1, 'utils': 1}
Traceback (most recent call last):
  File "C:\Users\Paul\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
    main()
  File "C:\Users\Paul\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 373, in main
    json_out["return_val"] = hook(**hook_input["kwargs"])
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Paul\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel
    return hook(config_settings)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Paul\AppData\Local\Programs\Python\Python312\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\Paul\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires
    self.run_setup()
  File "C:\Users\Paul\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup
    super().run_setup(setup_script=setup_script)
  File "C:\Users\Paul\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup
    exec(code, locals())
  File "<string>", line 210, in <module>
  File "C:\Users\Paul\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Paul\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Paul\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Paul\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel

Python version: 3.12.10 Installed pip packages:

Package                    Version
-------------------------- ------------
absl-py                    2.3.0
accelerate                 1.8.1
aiohappyeyeballs           2.6.1
aiohttp                    3.12.13
aiosignal                  1.3.2
annotated-types            0.7.0
antlr4-python3-runtime     4.9.3
anyascii                   0.3.3
attrs                      25.3.0
audioread                  3.0.1
babel                      2.17.0
bitsandbytes               0.46.0
black                      25.1.0
build                      1.2.2.post1
certifi                    2025.6.15
cffi                       1.17.1
cfgv                       3.4.0
charset-normalizer         3.4.2
click                      8.2.1
colorama                   0.4.6
coloredlogs                15.0.1
contourpy                  1.3.2
coqpit-config              0.2.0
coqui-tts                  0.26.2
coqui-tts-trainer          0.2.3
coverage                   7.9.1
cycler                     0.12.1
Cython                     3.1.2
datasets                   3.6.0
dateparser                 1.1.8
decorator                  5.2.1
decord                     0.6.0
diffusers                  0.33.1
dill                       0.3.8
distlib                    0.3.9
docopt                     0.6.2
einops                     0.8.1
encodec                    0.1.1
filelock                   3.18.0
flake8                     7.3.0
flatbuffers                25.2.10
fonttools                  4.58.4
frozenlist                 1.7.0
fsspec                     2025.3.0
ftfy                       6.3.1
gitdb                      4.0.12
GitPython                  3.1.44
grpcio                     1.73.0
gruut                      2.4.0
gruut-ipa                  0.13.0
gruut_lang_de              2.0.1
gruut_lang_en              2.0.1
gruut_lang_es              2.0.1
gruut_lang_fr              2.0.2
hjson                      3.1.0
huggingface-hub            0.33.0
humanfriendly              10.0
identify                   2.6.12
idna                       3.10
imageio                    2.37.0
imageio-ffmpeg             0.6.0
importlib_metadata         8.7.0
inflect                    7.5.0
iniconfig                  2.1.0
intel-cmplr-lib-ur         2025.2.0
intel-openmp               2025.2.0
Jinja2                     3.1.6
joblib                     1.5.1
jsonlines                  1.2.0
kiwisolver                 1.4.8
lazy_loader                0.4
librosa                    0.11.0
lightning                  2.5.2
lightning-utilities        0.14.3
llvmlite                   0.44.0
Markdown                   3.8.2
MarkupSafe                 3.0.2
matplotlib                 3.10.3
mccabe                     0.7.0
monotonic-alignment-search 0.2.0
more-itertools             10.7.0
mpmath                     1.3.0
msgpack                    1.1.1
multidict                  6.5.0
multiprocess               0.70.16
mypy                       1.16.1
mypy_extensions            1.1.0
networkx                   3.5
ninja                      1.11.1.4
nodeenv                    1.9.1
num2words                  0.5.14
numba                      0.61.2
numpy                      2.2.6
omegaconf                  2.3.0
onnxruntime-gpu            1.22.0
opencv-python              4.11.0.86
packaging                  25.0
pandas                     2.3.0
pathspec                   0.12.1
peft                       0.15.2
pillow                     11.2.1
pip                        25.1.1
platformdirs               4.3.8
pluggy                     1.6.0
pooch                      1.8.2
pre_commit                 4.2.0
propcache                  0.3.2
protobuf                   6.31.1
psutil                     7.0.0
py-cpuinfo                 9.0.0
pyarrow                    20.0.0
pycodestyle                2.14.0
pycparser                  2.22
pydantic                   2.11.7
pydantic_core              2.33.2
pyflakes                   3.4.0
Pygments                   2.19.2
pyparsing                  3.2.3
pyproject_hooks            1.2.0
pyreadline3                3.5.4
pysbd                      0.3.4
pytest                     8.4.1
pytest-cov                 6.2.1
python-crfsuite            0.9.11
python-dateutil            2.9.0.post0
pytorch-lightning          2.5.2
pytz                       2025.2
PyYAML                     6.0.2
regex                      2024.11.6
requests                   2.32.4
safetensors                0.5.3
scikit-image               0.25.2
scikit-learn               1.7.0
scipy                      1.16.0
seaborn                    0.13.2
sentencepiece              0.2.0
sentry-sdk                 2.30.0
setproctitle               1.3.6
setuptools                 80.9.0
six                        1.17.0
smmap                      5.0.2
soundfile                  0.13.1
soxr                       0.5.0.post1
sympy                      1.14.0
tbb                        2022.2.0
tcmlib                     1.4.0
tensorboard                2.19.0
tensorboard-data-server    0.7.2
threadpoolctl              3.6.0
tifffile                   2025.6.11
timm                       1.0.15
tokenizers                 0.21.1
torch                      2.7.1
torchaudio                 2.7.1
torchmetrics               1.7.3
torchvision                0.22.1
tqdm                       4.67.1
transformers               4.51.3
triton-windows             3.3.1.post19
typeguard                  4.4.4
typing_extensions          4.14.0
typing-inspection          0.4.1
tzdata                     2025.2
tzlocal                    5.3.1
umf                        0.11.0
urllib3                    2.5.0
virtualenv                 20.31.2
wandb                      0.20.1
wcwidth                    0.2.13
Werkzeug                   3.1.3
xxhash                     3.5.0
yarl                       1.20.1
zipp                       3.23.0

pytorch is compiled with libuv.

CUDA version: v12.8 NVIDIA cuDSS: v0.6 NVIDIA cuSPARSELt: v0.7 NVIDIA CUDNN: v9.8

However, when running python setup.py from the regular command line, I get a different output:

E:\git\extern\DeepSpeed>python setup.py
DS_BUILD_OPS=1
test.c
LINK : fatal error LNK1181: cannot open input file 'aio.lib'
 [WARNING]  Skip pre-compile of incompatible async_io; One can disable async_io with DS_BUILD_AIO=0
 [WARNING]  Skip pre-compile of incompatible evoformer_attn; One can disable evoformer_attn with DS_BUILD_EVOFORMER_ATTN=0
 [WARNING]  Skip pre-compile of incompatible fp_quantizer; One can disable fp_quantizer with DS_BUILD_FP_QUANTIZER=0
test.c
LINK : fatal error LNK1181: cannot open input file 'cufile.lib'
 [WARNING]  Skip pre-compile of incompatible gds; One can disable gds with DS_BUILD_GDS=0
 [WARNING]  Filtered compute capabilities [['6', '0'], ['6', '1'], ['7', '0']]
Traceback (most recent call last):
  File "E:\git\extern\DeepSpeed\setup.py", line 201, in <module>
    ext_modules.append(builder.builder())
                       ^^^^^^^^^^^^^^^^^
  File "E:\git\extern\DeepSpeed\op_builder\builder.py", line 731, in builder
    extra_link_args=self.strip_empty_entries(self.extra_ldflags()))
                                             ^^^^^^^^^^^^^^^^^^^^
  File "E:\git\extern\DeepSpeed\op_builder\inference_cutlass_builder.py", line 74, in extra_ldflags
    import dskernels
ModuleNotFoundError: No module named 'dskernels'

OK, I managed to compile it by disabling the following at the top of setup.py:

os.environ['DS_BUILD_AIO'] = '0'  # Ensure reproducibility.
os.environ['DS_BUILD_CUTLASS_OPS'] = '0'
os.environ['DS_BUILD_RAGGED_DEVICE_OPS'] = '0'
os.environ['DS_BUILD_EVOFORMER_ATTN'] = '0'

As mentioned here (not sure if it's still needed?)

Next, it tries to load git through bash, which won't work for windows. On line 210, I replaced it with:

# Write out version/git info.
if sys.platform == "win32":
    git_hash_cmd = shlex.split("git rev-parse --short HEAD")
    git_branch_cmd = shlex.split("git rev-parse --abbrev-ref HEAD")
else:
    git_hash_cmd = shlex.split("bash -c \"git rev-parse --short HEAD\"")
    git_branch_cmd = shlex.split("bash -c \"git rev-parse --abbrev-ref HEAD\"")

prijkes avatar Jun 29 '25 13:06 prijkes