You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By follow the README, the error happened below while pip install -r requirements.txt:
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 35, in <module>
File "/private/var/folders/dq/dp0bbpdj7tg9sm46bzynwv9m0000gn/T/pip-install-cb1_4zgz/flash-attn_c7e7b057ca0d44739190bf172b41cc3a/setup.py", line 22, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
[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.
It looks like torch is already in your requirements.txt file. The error you're seeing often happens because the flash-attn package needs torch to be installed before pip tries to install flash-attn.
Pip subprocess error:
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
/private/var/folders/dq/dp0bbpdj7tg9sm46bzynwv9m0000gn/T/pip-install-avkc9l69/flash-attn_ccb8da609c1049a6b82129648595c66f/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 "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 35, in <module>
File "/private/var/folders/dq/dp0bbpdj7tg9sm46bzynwv9m0000gn/T/pip-install-avkc9l69/flash-attn_ccb8da609c1049a6b82129648595c66f/setup.py", line 227, in <module>
CUDAExtension(
File "/opt/homebrew/Caskroom/miniforge/base/envs/.conda/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 1279, in CUDAExtension
library_dirs += library_paths(device_type="cuda")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/.conda/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 1508, in library_paths
if (not os.path.exists(_join_cuda_home(lib_dir)) and
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/.conda/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 2907, 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.7.1
[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.
Activity
[-]Failed to install flash-attn[/-][+]Failed to install flash-attn on Mac OSX[/+]zhongl commentedon Aug 28, 2025
After install torch by hand, new error happens: