-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't be installed using "uv" due to an issue in the setup script #833
Comments
I'm not sure how this works, do you have a suggestion? |
Perhaps packaging can be moved to My PR uses this to avoid having |
@tridao If flash-attn does not JIT but only precompile during setup, it may be best to move all non-runtime depends in setup.py to |
Related to (or almost a dupe of) #453 I believe. |
I've been investigating this for the past hour or two, and here's what I have learned: Short version:The best flash-attn can do is detect that it's running in build-isolated mode, and that its required modules (like Long version:(Background : This is all due to build isolation, which is enabled by pip most of the time when installing python modules. You could put You can move stuff like [build-system]
requires = ["wheel", "packaging", "ninja"]
build-backend = "setuptools.build_meta" But that doesn't work either because you won't have So I think the best course of action for try:
from packaging.version import parse, Version
except ImportError:
# The inability to import packaging.version is likely due to running with build isolation
print(
"""Could not import the 'packaging' module. You likely forgot to install without the "--build-isolation" flag. Follow the installation instructions here: https://github.com/Dao-AILab/flash-attention?tab=readme-ov-file#installation-and-features"""
)
exit(1) There are a few places you'd need to do that conditional import or check for a module: I wrote up similar findings for |
It's wild that pypa/pip#8437 is locked. |
FWIW, a [project]
name = "asdf"
version = "0.1.0"
description = "asdf"
authors = [
{ name = "me", email = "me@gmail.com" }
]
requires-python = "~=3.11"
dependencies = [
"bitsandbytes~=0.43",
"datasets~=2.20",
"devtools>=0.12.2",
"numpy~=1.26",
"optuna~=3.6",
"pandas>=2.2.2",
"peft~=0.11",
"pillow~=10.4",
"pydantic~=2.8",
"schedulefree>=1.2.6",
"scikit-learn~=1.5",
"scipy~=1.14",
"timm~=1.0",
"torch==2.3.0",
"torchvision~=0.18.0",
"transformers~=4.42",
"triton~=2.3.0",
"wandb>=0.17.4",
"flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.6.3/flash_attn-2.6.3+cu123torch2.3cxx11abiFALSE-cp311-cp311-linux_x86_64.whl"
] |
See astral-sh/uv#1582 (comment) for full context, but flash-attn can't be installed because it references
packaging
at the top of the setup script, then lists it as a dependency lower in the script:https://github.com/Dao-AILab/flash-attention/blob/5cdabc2809095b98c311283125c05d222500c8ff/setup.py#L9C6-L9C15
Instead packaging cannot be used and be a dependency at the same time.
The text was updated successfully, but these errors were encountered: