Dao-AILab / flash-attention

Fast and memory-efficient exact attention
BSD 3-Clause "New" or "Revised" License
14.34k stars 1.35k forks source link

can not install #948

Open waldolin opened 6 months ago

waldolin commented 6 months ago

PS C:\Users\lin> pip install flash-attn --no-build-isolation Collecting flash-attn Downloading flash_attn-2.5.8.tar.gz (2.5 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.5/2.5 MB 1.9 MB/s eta 0:00:00 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] error: pathspec 'csrc/cutlass' did not match any file(s) known to git C:\Users\lin\AppData\Local\Temp\pip-install-osxr8hp3\flash-attn_cb862e77446e473bbca69f712312cd0b\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 34, in File "C:\Users\lin\AppData\Local\Temp\pip-install-osxr8hp3\flash-attn_cb862e77446e473bbca69f712312cd0b\setup.py", line 134, in CUDAExtension( File "C:\Users\lin\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\cpp_extension.py", line 1074, in CUDAExtension library_dirs += library_paths(cuda=True) File "C:\Users\lin\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\cpp_extension.py", line 1208, in library_paths paths.append(_join_cuda_home(lib_dir)) File "C:\Users\lin\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\cpp_extension.py", line 2407, 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.2.2+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.

geyan21 commented 1 month ago

You can first check if the nvcc is installed. conda install -c nvidia cuda-nvcc solved this error for me.