Collecting flash-attn (from -r requirements.txt (line 56))
Downloading flash_attn-2.8.1.tar.gz (8.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.2/8.2 MB 37.3 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
╰─> [39 lines of output]
/tmp/pip-install-7kc7ccaf/flash-attn_789492e361db43daa7457df2a1e025a8/setup.py:106: 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
exec(compile('''
~~~~^^^^^^^^^^^^
# This is -- a caller that pip uses to run setup.py
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<32 lines>...
exec(compile(setup_py_code, filename, "exec"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
''' % ('/tmp/pip-install-7kc7ccaf/flash-attn_789492e361db43daa7457df2a1e025a8/setup.py',), "", "exec"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 35, in
File "/tmp/pip-install-7kc7ccaf/flash-attn_789492e361db43daa7457df2a1e025a8/setup.py", line 230, in
CUDAExtension(
~~~~~~~~~~~~~^
name="flash_attn_2_cuda",
^^^^^^^^^^^^^^^^^^^^^^^^^
...<83 lines>...
],
^^
)
^
File "/root/miniconda3/lib/python3.13/site-packages/torch/utils/cpp_extension.py", line 1279, in CUDAExtension
library_dirs += library_paths(device_type="cuda")
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/lib/python3.13/site-packages/torch/utils/cpp_extension.py", line 1490, in library_paths
if (not os.path.exists(_join_cuda_home(lib_dir)) and
~~~~~~~~~~~~~~~^^^^^^^^^
File "/root/miniconda3/lib/python3.13/site-packages/torch/utils/cpp_extension.py", line 2889, in _join_cuda_home
raise OSError('CUDA_HOME environment variable is not set. '
'Please set it to your CUDA install root.')
OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
torch.__version__ = 2.7.0+cu128
[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.
Please refer to the official FlashAttention repository for installation instructions for this package.
The setup file takes care of the issue