pip install flash_attn==2.5.9.post1 --no-build-isolation doesn't work
Whenever I type in pip install flash_attn==2.5.9.post1 --no-build-isolation I get the following error:
(seedvr) U:\SeedVR>pip install flash_attn==2.5.9.post1 --no-build-isolation Collecting flash_attn==2.5.9.post1 Using cached flash_attn-2.5.9.post1.tar.gz (2.6 MB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
fatal: not a git repository (or any of the parent directories): .git
C:\Users\karyu\AppData\Local\Temp\pip-install-o5hwfarl\flash-attn_78ec49ae28a14677a124eca79185d543\setup.py:78: UserWarning: flash_attn was requested, but nvcc was not found. Are you sure your environment has nvcc available? If you're installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain 'devel' will provide nvcc.
warnings.warn(
Traceback (most recent call last):
File "
torch.__version__ = 2.3.0+cpu
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details.
CUDA is installed on my Windows 11 PC and the CUDA_HOME has been set correctly in the environment variables.
Hi! Thanks for your interest of our work! Unfortunately, we never test the env on Windows. We did not get such a problem on Linux during test.
I got exactly the same error on my Windows 10 machine. I don't know enough to fix this problem, can anyone provide a solution to this install issue?
Linux
DEPRECATION: Building 'flash_attn' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use the standardized build interface by setting the --use-pep517 option, (possibly combined with --no-build-isolation), or adding a pyproject.toml file to the source tree of 'flash_attn'. Discussion can be found at https://github.com/pypa/pip/issues/6334
how it comes to publish something that works only on linux while most of the world use windows XD
It should work on Windows. We just didn't test on it and some potential env issues may need more efforts. We are not developing products and we do not ask for payment. We are just here to provide help as possible as we can. If you want to use it on your device, you test it.
Whenever I type in pip install flash_attn==2.5.9.post1 --no-build-isolation I get the following error:
(seedvr) U:\SeedVR>pip install flash_attn==2.5.9.post1 --no-build-isolation Collecting flash_attn==2.5.9.post1 Using cached flash_attn-2.5.9.post1.tar.gz (2.6 MB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [20 lines of output] fatal: not a git repository (or any of the parent directories): .git C:\Users\karyu\AppData\Local\Temp\pip-install-o5hwfarl\flash-attn_78ec49ae28a14677a124eca79185d543\setup.py:78: UserWarning: flash_attn was requested, but nvcc was not found. Are you sure your environment has nvcc available? If you're installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain 'devel' will provide nvcc. warnings.warn( Traceback (most recent call last): File "", line 2, in File "", line 35, in File "C:\Users\karyu\AppData\Local\Temp\pip-install-o5hwfarl\flash-attn_78ec49ae28a14677a124eca79185d543\setup.py", line 134, in CUDAExtension( File "C:\Users\karyu.conda\envs\seedvr\lib\site-packages\torch\utils\cpp_extension.py", line 1077, in CUDAExtension library_dirs += library_paths(cuda=True) File "C:\Users\karyu.conda\envs\seedvr\lib\site-packages\torch\utils\cpp_extension.py", line 1211, in library_paths paths.append(_join_cuda_home(lib_dir)) File "C:\Users\karyu.conda\envs\seedvr\lib\site-packages\torch\utils\cpp_extension.py", line 2419, in _join_cuda_home raise OSError('CUDA_HOME environment variable is not set. ' OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
torch.__version__ = 2.3.0+cpu [end of output]note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details.
CUDA is installed on my Windows 11 PC and the CUDA_HOME has been set correctly in the environment variables.
I just notice that you are using torch cpu rather than gpu. This should be the problem.
Just use a prebuilt wheel from one of these releases https://github.com/mjun0812/flash-attention-prebuild-wheels/releases
Just use a prebuilt wheel from one of these releases https://github.com/mjun0812/flash-attention-prebuild-wheels/releases
Those all appear to be LINUX wheels, not for Windows.
Solution that worked for me:
Install this in your activated environment:
pip install torch==2.5.1+cu121 torchvision==0.20.1+cu121 torchaudio==2.5.1+cu121 --index-url https://download.pytorch.org/whl/cu121
Then install:
pip install flash_attn==2.5.9.post1 --no-build-isolation
It's building the wheel now at least, so time shall tell...
Actually, that failed:
here windows wheel.. https://github.com/kingbri1/flash-attention/releases