21X5122
@21X5122

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

FlashAttentionのインストールエラー:「CUDA 11.6以上」が必要とのエラーメッセージ

こんにちは、

pipを使用してflash-attn(バージョン2.6.3)をインストールしようとしたところ、エラーメッセージに「CUDA 11.6以上が必要」と表示されました。しかし、私の環境ではCUDA 11.8を使用しており(torch.__version__ = 2.5.0+cu118)、メタデータ生成の段階でインストールが失敗してしまいます。どうすればよいかわからないので、以下にエラーメッセージの詳細を記載します。

Collecting flash-attn
  Using cached flash_attn-2.6.3.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
  ╰─> [12 lines of output]
      fatal: not a git repository (or any of the parent directories): .git
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-ur6gdyxq/flash-attn_8aaa3421ed454954b43cbcebfe9bb28e/setup.py", line 160, in <module>
          raise RuntimeError(
      RuntimeError: FlashAttention is only supported on CUDA 11.6 and above.  Note: make sure nvcc has a supported version by running nvcc -V.
      
      
      torch.__version__  = 2.5.0+cu118
      
      
      [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.

nvcc -VコマンドでCUDAのバージョンを確認したところ、CUDA 11.8がインストールされていることを確認しました。

この問題を解決するために、何かアドバイスや提案をいただけないでしょうか?flash-attnとの互換性を確保するために他に確認すべき点があれば教えてください。

どうぞよろしくお願いいたします。

0

1Answer

エラーメッセージで検索してみると、githubのissueが見つかりました。
参考になりませんか?

It is due to nvcc cuda version different with nvidia-smi cuda version.
I add following env in the ~/.bashrc, then this issue fix.
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

0Like

Your answer might help someone💌