rye icon indicating copy to clipboard operation
rye copied to clipboard

Known Problematic Packages

Open mitsuhiko opened this issue 1 year ago • 5 comments

This is a meta issue tracking issues with packages where the issue is with the upstream package.

  • flash-attn (https://github.com/Dao-AILab/flash-attention/issues/773): Package does not build wheels and the build dependencies are incorrectly defined.
  • jax[cuda12_pip] refuses to install (https://github.com/mitsuhiko/rye/issues/420)

mitsuhiko avatar Jan 21 '24 19:01 mitsuhiko

uv supports --no-build-isolation flag(related PR) as of version v0.1.16. I confirmed that running uv pip install flash-attn --no-build-isolation is successfully built and installed flash-attn package. But I couldn't found a way to integrate this flag to rye add command. It would be awesome if rye supports it in the near future.

ilkersigirci avatar Mar 11 '24 11:03 ilkersigirci

I wish rye would support building these packages (e.g. by allowing me to specify their build dependencies in my pyproject.toml) as it doesn't look like they'll get fixed anytime soon, if ever.

In the meantime I have found a workaround to install them; not sure if this is the best way to do it (probably not), but it seems to work. For example, to get the flash attention package installed you can do this (note: I'm using the uv backend for rye):

  1. rye init -p 3.11.8 foobar (not strictly necessary to specify the version, but some of the widely used ML packages are still broken on 3.12 that would otherwise get used by default)
  2. cd foobar
  3. Add build deps as dependencies: rye add wheel setuptools packaging pip torch
  4. Paste this as setup.sh:
#!/bin/bash

set -euxo pipefail

FLASH_ATTENTION_TAG=v2.5.6
FLASH_ATTENTION_WHEEL="flash_attn-2.5.6-cp311-cp311-linux_x86_64.whl"

CWD="$(pwd)"
source .venv/bin/activate

rye sync --no-dev

if [ ! -d "/tmp/flash-attention" ]; then
    git clone "https://github.com/Dao-AILab/flash-attention.git" /tmp/flash-attention
fi

if [ ! -f "$CWD/.venv/wheels/$FLASH_ATTENTION_WHEEL" ]; then
    cd /tmp/flash-attention
    git checkout $FLASH_ATTENTION_TAG
    if [ ! -f "dist/$FLASH_ATTENTION_WHEEL" ]; then
        python setup.py bdist_wheel
    fi
    mkdir -p "$CWD/.venv/wheels/"
    cp dist/$FLASH_ATTENTION_WHEEL "$CWD/.venv/wheels/"
fi

cd $CWD
rye add --dev --no-sync "flash_attn @ file://.venv/wheels/$FLASH_ATTENTION_WHEEL"
rye sync
  1. Run setup.sh. From now on when you want to fetch and install all of the dependencies from scratch run setup.sh instead of rye sync.

koute avatar Mar 12 '24 04:03 koute

Will there be any official future work here @mitsuhiko ? Thanks

ilkersigirci avatar Apr 09 '24 21:04 ilkersigirci

@koute : How does this fix/workaround affect your lockfile?

Taytay avatar May 21 '24 18:05 Taytay