bentoml / BentoML

The easiest way to serve AI apps and models - Build Model Inference APIs, Job queues, LLM apps, Multi-model pipelines, and more!
https://bentoml.com
Apache License 2.0
7.18k stars 793 forks source link

bug: bentoml containerize failed by uv installation location change #5069

Closed lingw777 closed 2 weeks ago

lingw777 commented 2 weeks ago

Describe the bug

My CICD build is failing at bentoml containerize

RUN curl -LO https://astral.sh/uv/install.sh &&     sh install.sh && rm install.sh && mv $HOME/.cargo/bin/uv /usr/local/bin/
#12 0.858 downloading uv 0.5.0 x86_64-unknown-linux-gnu
#12 1.514 installing to /root/.local/bin
#12 1.553 mv: cannot stat '/root/.cargo/bin/uv': No such file or directory

It's probably related to recent uv release. See https://github.com/astral-sh/uv/issues/8913

To reproduce

No response

Expected behavior

No response

Environment

bentoml: 1.3.10 python: 3.10 platform: --opt platform=linux/amd64,linux/arm64

lingw777 commented 2 weeks ago

Found this breaking change in uv release note

Use XDG (i.e. ~/.local/bin) instead of the Cargo home directory in the installer (#8420)

Previously, uv's installer used $CARGO_HOME or ~/.cargo/bin for its target install directory. It's been a longstanding complaint that uv uses this directory, as there's no relationship to Cargo. Now, uv will be installed into $XDG_BIN_HOME, $XDG_DATA_HOME/../bin, or ~/.local/bin (in that order). Note that $UV_INSTALL_DIR can always be used to override the target directory. Upgrading with uv self update will not move uv to the new install directory.

and bentoML base docker image scripts pull from latest installation scripts https://astral.sh/uv/install.sh but still trying to mv $HOME/.cargo/bin/uv
See https://github.com/bentoml/BentoML/blob/0088c75f0c58a8fec1b147678756213e44007617/src/bentoml/_internal/container/frontend/dockerfile/templates/base_debian.j2#L17

frostming commented 2 weeks ago

The fix is on the way to the next release.

mobecks commented 2 weeks ago

Workaround until next release (worked for me): change above-mentioned "line 17" to sh install.sh && rm install.sh && mv $HOME/.local/bin/uv /usr/local/bin/

aarnphm commented 2 weeks ago

This has now been fixed with 1.3.11

mexicat commented 2 weeks ago

Thanks for the quick fix, but wouldn't it be good to pin a uv installer version in Dockerfiles (i.e. https://astral.sh/uv/0.5.1/install.sh instead of https://astral.sh/uv/install.sh) to avoid future breakage due to internal changes in uv?

JustineAssoulant commented 1 week ago

Hello, I replaced "sh install.sh && rm install.sh && mv $HOME/.cargo/bin/uv /usr/local/bin/" by "sh install.sh && rm install.sh && mv $HOME/.local/bin/uv /usr/local/bin/" in the dockerfile generated by bentoml when we build the bento, but when i try to containerize my bento i still have the same mistake and I can easily see that it tries to containerize the bento based not on my modified dockerfile :(

frostming commented 6 days ago

@JustineAssoulant yeah, the containerize command regenerates the dockerfile on the fly.

The best way is to upgrade the version of bentoml