DeepSpeed icon indicating copy to clipboard operation
DeepSpeed copied to clipboard

[Error] [Win] Unable to pre-compile async_io on Windows

Open affanmehmood opened this issue 3 years ago • 13 comments

Describe the bug I was trying to install Deepspeed on WIndows inside a python virtual environment. I have been told that Deepspeed has not been tested on windows so far as Deepspeed has primarily been used on Linux. @tjruwase what do you think is causing it?

To Reproduce Steps to reproduce the behaviour:

  1. Install PyTorch (I have torch=1.10.2+cu113 on RTX2060)
  2. pip install deepspeed

Expected behavior Deepspeed should be installed

ds_report output Collecting deepspeed Using cached deepspeed-0.5.10.tar.gz (515 kB) ERROR: Command errored out with exit status 1: command: 'c:\users\divedeepai\desktop\fast-gpt-j\venv\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\DIVEDE~1\AppData\Local\Temp\pip-install-wd7js0qm\deepspeed\setup.py'"'"'; file='"'"'C:\Users\DIVEDE~1\AppData\Local\Temp\pip-install-wd7js0qm\deepspeed\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\DIVEDE~1\AppData\Local\Temp\pip-pip-egg-info-66ojul50' cwd: C:\Users\DIVEDE~1\AppData\Local\Temp\pip-install-wd7js0qm\deepspeed
Complete output (26 lines): The system cannot find the file specified. The system cannot find the file specified. The system cannot find the file specified. The system cannot find the file specified. test.c LINK : fatal error LNK1181: cannot open input file 'aio.lib' Traceback (most recent call last): File "", line 1, in File "C:\Users\DIVEDE~1\AppData\Local\Temp\pip-install-wd7js0qm\deepspeed\setup.py", line 138, in abort(f"Unable to pre-compile {op_name}") File "C:\Users\DIVEDE~1\AppData\Local\Temp\pip-install-wd7js0qm\deepspeed\setup.py", line 43, in abort assert False, msg AssertionError: Unable to pre-compile async_io DS_BUILD_OPS=1 [WARNING] cpu_adam requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adam attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. [WARNING] cpu_adam requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adam attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. [WARNING] cpu_adagrad requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adagrad attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. [WARNING] cpu_adagrad requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adagrad attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. [WARNING] async_io requires the dev libaio .so object and headers but these were not found. [WARNING] If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found. [WARNING] One can disable async_io with DS_BUILD_AIO=0 [ERROR] Unable to pre-compile async_io ----------------------------------------

System info (please complete the following information):

  • Windows 10
  • RTX 2060
  • Python version 3.7.9

affanmehmood avatar Feb 14 '22 07:02 affanmehmood

@affanmehmood, thanks for creating this issue. My recollection is that libaio-dev is Linux library that is not available in Windows, so can you please share more details on how you installed this on Windows. One way to work around this for now is to disable async_io by setting environment variable DS_BUILD_AIO to 0 image

tjruwase avatar Feb 14 '22 13:02 tjruwase

I was unable to disable async_io by setting the environment variable, after manually ignoring async_io and sparse_attn I am now getting this error. ERROR: Command errored out with exit status 1: command: 'c:\users\divedeepai\desktop\fast-gpt-j\venv\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\DiveDeepAI\Desktop\Fast-GPT-J\DeepSpeed\setup.py'"'"'; file='"'"'C:\Users\DiveDeepAI\Desktop\Fast-GPT-J\DeepSpeed\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\DIVEDE~1\AppData\Local\Temp\pip-pip-egg-info-vw6et02g' cwd: C:\Users\DiveDeepAI\Desktop\Fast-GPT-J\DeepSpeed
Complete output (22 lines): The system cannot find the file specified. The system cannot find the file specified. The system cannot find the file specified. The system cannot find the file specified. Traceback (most recent call last): File "", line 1, in File "C:\Users\DiveDeepAI\Desktop\Fast-GPT-J\DeepSpeed\setup.py", line 193, in create_dir_symlink('..\..\csrc', '.\deepspeed\ops\csrc') File "C:\Users\DiveDeepAI\Desktop\Fast-GPT-J\DeepSpeed\setup.py", line 187, in create_dir_symlink os.symlink(src, dest) OSError: symbolic link privilege not held DS_BUILD_OPS=1 install_ops {'cpu_adam': False, 'cpu_adagrad': False, 'fused_adam': False, 'fused_lamb': False, 'sparse_attn': 0, 'transformer': False, 'stochastic_transformer': False, 'async_io': 0, 'utils': False, 'quantizer': False, 'transformer_inference': False} [WARNING] cpu_adam requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adam attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. [WARNING] cpu_adam requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adam attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. [WARNING] cpu_adagrad requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adagrad attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. [WARNING] cpu_adagrad requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adagrad attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. Install Ops={'cpu_adam': 1, 'cpu_adagrad': 1, 'fused_adam': 1, 'fused_lamb': 1, 'sparse_attn': 0, 'transformer': 1, 'stochastic_transformer': 1, 'async_io': 0, 'utils': 1, 'quantizer': 1, 'transformer_inference': 1} ----------------------------------------

affanmehmood avatar Feb 14 '22 15:02 affanmehmood

I was unable to disable async_io by setting the environment variable, after manually ignoring async_io and sparse_attn I am now getting this error. ERROR: Command errored out with exit status 1: command: 'c:\users\divedeepai\desktop\fast-gpt-j\venv\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\DiveDeepAI\Desktop\Fast-GPT-J\DeepSpeed\setup.py'"'"'; file='"'"'C:\Users\DiveDeepAI\Desktop\Fast-GPT-J\DeepSpeed\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\DIVEDE~1\AppData\Local\Temp\pip-pip-egg-info-vw6et02g' cwd: C:\Users\DiveDeepAI\Desktop\Fast-GPT-J\DeepSpeed Complete output (22 lines): The system cannot find the file specified. The system cannot find the file specified. The system cannot find the file specified. The system cannot find the file specified. Traceback (most recent call last): File "", line 1, in File "C:\Users\DiveDeepAI\Desktop\Fast-GPT-J\DeepSpeed\setup.py", line 193, in create_dir_symlink('....\csrc', '.\deepspeed\ops\csrc') File "C:\Users\DiveDeepAI\Desktop\Fast-GPT-J\DeepSpeed\setup.py", line 187, in create_dir_symlink os.symlink(src, dest) OSError: symbolic link privilege not held DS_BUILD_OPS=1 install_ops {'cpu_adam': False, 'cpu_adagrad': False, 'fused_adam': False, 'fused_lamb': False, 'sparse_attn': 0, 'transformer': False, 'stochastic_transformer': False, 'async_io': 0, 'utils': False, 'quantizer': False, 'transformer_inference': False} [WARNING] cpu_adam requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adam attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. [WARNING] cpu_adam requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adam attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. [WARNING] cpu_adagrad requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adagrad attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. [WARNING] cpu_adagrad requires the 'lscpu' command, but it does not exist! [WARNING] cpu_adagrad attempted to query 'lscpu' after failing to use py-cpuinfo to detect the CPU architecture. 'lscpu' does not appear to exist on your system, will fall back to use -march=native and non-vectorized execution. Install Ops={'cpu_adam': 1, 'cpu_adagrad': 1, 'fused_adam': 1, 'fused_lamb': 1, 'sparse_attn': 0, 'transformer': 1, 'stochastic_transformer': 1, 'async_io': 0, 'utils': 1, 'quantizer': 1, 'transformer_inference': 1} ---------------------------------------- I'm having the same problem now. Got a good plan, bro.

Fjia-f avatar Mar 14 '23 11:03 Fjia-f

Any resolution for this? I am facing the same issue.

LiveRock avatar Mar 18 '23 04:03 LiveRock

Nope. seems like there is no support for Windows. #2427

affanmehmood avatar Mar 18 '23 10:03 affanmehmood

Too funny!

schwarztim avatar Mar 22 '23 12:03 schwarztim

So far haven't found a workaround for insdtalling DeepSpeed on windows

actyinc avatar Apr 10 '23 22:04 actyinc

Any resolution for this? I am facing the same issue.

me too

x56080 avatar Apr 19 '23 06:04 x56080

me too

zx159753zx avatar Apr 19 '23 07:04 zx159753zx

I ran into the same problem but may have a workaround for those of you using Windows, sort of. I set up WSL Ubuntu 20.04 on windows 10 and got Successfully built deepspeed pathtools lit

I had to do the usual python3 setup within WSL, it doesn't use what you may have already installed on your Windows system, but once that was done, and after collecting all the dependencies, it worked.

datatribe avatar Apr 22 '23 18:04 datatribe

See https://github.com/microsoft/DeepSpeed for instructions on building on Windows.

jonfleming avatar Apr 30 '23 01:04 jonfleming

If people insist on not building things that work, at least release a docker container image with the right settings to make it work rather than making users jump through hoops.

SimulacraAtTanagra avatar May 02 '23 02:05 SimulacraAtTanagra

Hello, I think I have your solution, though you're not going to like it.

The "Unable to pre-compile async_io" error can occur when installing DeepSpeed on Windows, and is usually caused by a missing dependency. Specifically, the async_io module used by DeepSpeed requires the libaio development files to be installed on the system. On Linux systems, these files are typically installed by default, but on Windows they need to be installed manually.

To resolve this issue, you can try installing the libaio development files on your Windows system using a package manager like Cygwin. Cygwin provides a Linux-like environment on Windows and includes a package for libaio-dev that you can install using the Cygwin installer. Once you have installed the libaio-dev package, you should be able to install DeepSpeed without encountering the async_io error.

However, even with the libaio development files installed, running DeepSpeed on Windows can be challenging, since DeepSpeed is optimized for Linux environments and relies on many Linux-specific features. Therefore, the best way to run DeepSpeed on Windows is to use the Windows Subsystem for Linux (WSL) or WSL2, which provide a more seamless experience.

WSL2 is the preferred option, since it provides a full Linux kernel and supports GPU acceleration through the DirectX 12 backend. With WSL2, you can install a Linux distribution like Ubuntu or Debian and use it to run DeepSpeed and other machine learning libraries without any compatibility issues. This provides a much better experience than trying to run DeepSpeed on a Windows CPU, which can be slow and may not support all the features of the library.

To review: if you encounter the "Unable to pre-compile async_io" error when installing DeepSpeed on Windows, you can try installing the libaio development files using a package manager like Cygwin. However, the best way to run DeepSpeed on Windows is to use the Windows Subsystem for Linux (WSL) or WSL2, which provide a Linux-like environment that is optimized for machine learning and provides a seamless experience.

If you must have your way with DeepSpeed on Windows, you'll likely need to fork TensorFlow and its dependencies and revise it to provide CUDA support on Windows past version 2.1. Good luck. Maybe build a model on Linux and have it guide you through this process. I think what it comes down to is projected use: these large language models are most often going to be run on servers, servers which are most often Linux based, due to the pricing constraints of Windows, and open-source developer contributions. To invest in supporting Windows (server) for the sake of satisfying some hobbyists desire to run deep learning natively on windows, would be a fool's errand. Until TensorFlow > 2.1 supports windows natively, you'll need to use WSL or WSL2. There is some irony there, but keep in mind, Microsoft has a vested interest Ubuntu Linux and works closely with Canonical and the Ubuntu community. They are just as much a Linux company now as they are a Windows company.

https://www.tensorflow.org/install/pip#windows-native

CodeByNate avatar May 09 '23 14:05 CodeByNate

a quick workaround is force BUILD_OP_PLATFORM = 0 in setup.py: BUILD_OP_PLATFORM = 1 if sys.platform == "win32" else 0

solves "AssertionError: Unable to pre-compile async_io" under windows

maxincow avatar Jul 31 '23 01:07 maxincow

Async_io isn't supported on Windows without using WSL to install this. If you are on Windows, then you will want to install DeepSpeed with DS_BUILD_AIO=0 pip install deepspeed since this will not install that op on your system.

Closing this for now, since there's nothing DeepSpeed can do for this, and the ds_report should list that this is an unsupported op on Windows.

loadams avatar Aug 14 '23 20:08 loadams

Why are you closing this WITHOUT taking the installer for Windows off your home page? And without telling all the companies using your API or imbedding DeepSpeed into THEIR Windows workable applications so they can do what you won't! They can find a replacement for DeepSpeed from a partner that DOES TRUELY support Windows!

DevManPGP avatar Aug 20 '23 20:08 DevManPGP

Excuse me. If you don’t understand WSL and Linux, what business do you have using DeepSpeed?

On Sun, Aug 20, 2023 at 3:10 PM Paul Paradise @.***> wrote:

Why are you closing this WITHOUT taking the installer for Windows off your home page? And without telling all the companies using your API or imbedding DeepSpeed into THEIR Windows workable applications so they can do what you won't! They can find a replacement for DeepSpeed from a partner that DOES TRUELY support Windows!

— Reply to this email directly, view it on GitHub https://github.com/microsoft/DeepSpeed/issues/1769#issuecomment-1685380194, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGXJ72IXHMEWPBRZTTIQIW3XWJVM5ANCNFSM5OKT4LPQ . You are receiving this because you commented.Message ID: @.***>

CodeByNate avatar Aug 20 '23 20:08 CodeByNate

When you install the lastest version(0.3.16), it works on the Windows System.

Haorotu avatar Oct 07 '23 01:10 Haorotu

I've met the same problem even on Linux😓, bothering me for 2 weeks!😭 But I can't find any solution...

LordEdison avatar Oct 30 '23 02:10 LordEdison

@LordEdison - if you are hitting an async io issue on Linux, you'll have a different issue than the main issue here on Windows. If so, can you please open a new issue and link this one? Thanks!

loadams avatar Oct 30 '23 22:10 loadams

+1, useless for windows as there is no way to build it normally.

nikich340 avatar Nov 10 '23 03:11 nikich340

Tried on WSL2, everything worked till installation but unable to build the model pipeline, even for a small model like OPT125m

Link to GitHub Issue

sumitsahaykoantek avatar Nov 14 '23 14:11 sumitsahaykoantek

Hello, I think I have your solution, though you're not going to like it.

The "Unable to pre-compile async_io" error can occur when installing DeepSpeed on Windows, and is usually caused by a missing dependency. Specifically, the async_io module used by DeepSpeed requires the libaio development files to be installed on the system. On Linux systems, these files are typically installed by default, but on Windows they need to be installed manually.

To resolve this issue, you can try installing the libaio development files on your Windows system using a package manager like Cygwin. Cygwin provides a Linux-like environment on Windows and includes a package for libaio-dev that you can install using the Cygwin installer. Once you have installed the libaio-dev package, you should be able to install DeepSpeed without encountering the async_io error.

However, even with the libaio development files installed, running DeepSpeed on Windows can be challenging, since DeepSpeed is optimized for Linux environments and relies on many Linux-specific features. Therefore, the best way to run DeepSpeed on Windows is to use the Windows Subsystem for Linux (WSL) or WSL2, which provide a more seamless experience.

WSL2 is the preferred option, since it provides a full Linux kernel and supports GPU acceleration through the DirectX 12 backend. With WSL2, you can install a Linux distribution like Ubuntu or Debian and use it to run DeepSpeed and other machine learning libraries without any compatibility issues. This provides a much better experience than trying to run DeepSpeed on a Windows CPU, which can be slow and may not support all the features of the library.

To review: if you encounter the "Unable to pre-compile async_io" error when installing DeepSpeed on Windows, you can try installing the libaio development files using a package manager like Cygwin. However, the best way to run DeepSpeed on Windows is to use the Windows Subsystem for Linux (WSL) or WSL2, which provide a Linux-like environment that is optimized for machine learning and provides a seamless experience.

If you must have your way with DeepSpeed on Windows, you'll likely need to fork TensorFlow and its dependencies and revise it to provide CUDA support on Windows past version 2.1. Good luck. Maybe build a model on Linux and have it guide you through this process. I think what it comes down to is projected use: these large language models are most often going to be run on servers, servers which are most often Linux based, due to the pricing constraints of Windows, and open-source developer contributions. To invest in supporting Windows (server) for the sake of satisfying some hobbyists desire to run deep learning natively on windows, would be a fool's errand. Until TensorFlow > 2.1 supports windows natively, you'll need to use WSL or WSL2. There is some irony there, but keep in mind, Microsoft has a vested interest Ubuntu Linux and works closely with Canonical and the Ubuntu community. They are just as much a Linux company now as they are a Windows company.

https://www.tensorflow.org/install/pip#windows-native

**alright **

CCodeInspect avatar Dec 02 '23 05:12 CCodeInspect

When you install the lastest version(0.3.16), it works on the Windows System.

Holy cow, it worked :D :D :D

CGMikeG avatar Jan 25 '24 10:01 CGMikeG

When you install the lastest version(0.3.16), it works on the Windows System.

Used pip install deepspeed==0.3.16 And yes, it's really working, thanks bro

Skala05reg avatar Feb 06 '24 15:02 Skala05reg

@Skala05reg - I believe they are referring to the latest async_io version. 0.3.16 is not the latest version of DeepSpeed, and is from April 2021.

loadams avatar Feb 06 '24 16:02 loadams

Makes sense Microsoft makes something that won't work in windows.

CrackerHax avatar Mar 08 '24 22:03 CrackerHax

When you install the lastest version(0.3.16), it works on the Windows System.

Used pip install deepspeed==0.3.16 And yes, it's really working, thanks bro

very good

GuanRainy avatar May 09 '24 09:05 GuanRainy

Kind of embarrassing the official install instructions is just "build it from scratch" and no mention that v0.3.16 installs fine on windows machines.

lewiswatson55 avatar Jul 01 '24 22:07 lewiswatson55

Hi @lewiswatson55 - older versions may work but lack newer features and support. If 0.3.16 (~3 years old) is sufficient for your needs, that's great. We are working on improving DeepSpeed on Windows. Currently, there is a batch file that can be used to build a wheel locally to be installed, and soon we should publish official Windows wheels on PyPI.

loadams avatar Jul 01 '24 22:07 loadams