Skip to content

Support flash attention flash-attn --no-build-isolation with uv sync #6437

@vwxyzjn

Description

@vwxyzjn

I get the following error despite installation flash attention was successful via uv add flash-attn --no-build-isolation. See #6402. Is there anyway to honor the no-build-isolation when doing uv sync? I imagine the idea is to mark the flash-attn dependencies somehow and run it with no-build-isolation after all the other dependencies have been installed.

pyproject.toml and uv.lock are here: https://gist.github.com/vwxyzjn/fba2c7ffac8e6c923ffe912a872ec9a8

  open-instruct git:(uv) ✗ uv sync
Using Python 3.12.5
Creating virtualenv at: .venv
⠦ fire==0.6.0                                                                                    error: Failed to download and build `flash-attn==2.6.3`
  Caused by: Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 14, in <module>
  File "/home/costa/.cache/uv/builds-v0/.tmpLR2n19/lib/python3.12/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/costa/.cache/uv/builds-v0/.tmpLR2n19/lib/python3.12/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
    self.run_setup()
  File "/home/costa/.cache/uv/builds-v0/.tmpLR2n19/lib/python3.12/site-packages/setuptools/build_meta.py", line 502, in run_setup
    super().run_setup(setup_script=setup_script)
  File "/home/costa/.cache/uv/builds-v0/.tmpLR2n19/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, in run_setup
    exec(code, locals())
  File "<string>", line 21, in <module>
ModuleNotFoundError: No module named 'torch'
---
  Caused by: This error likely indicates that flash-attn==2.6.3 depends on torch, but doesn't declare it as a build dependency. If flash-attn==2.6.3 is a first-party package, consider adding torch to its `build-system.requires`. Otherwise, `uv pip install torch` into the environment and re-run with `--no-build-isolation`.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or improvement to existing functionalityprojectsRelated to project management capabilities

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions