Use uv pip install instead of pip install

This commit is contained in:
Ashwin Bharambe 2025-01-31 21:38:54 -08:00
parent c6d9ff2054
commit 62b54fd70c
11 changed files with 40 additions and 36 deletions

View file

@ -183,9 +183,9 @@ def run_stack_build_command(
build_config.distribution_spec.providers build_config.distribution_spec.providers
) )
normal_deps += SERVER_DEPENDENCIES normal_deps += SERVER_DEPENDENCIES
print(f"pip install {' '.join(normal_deps)}") print(f"uv pip install {' '.join(normal_deps)}")
for special_dep in special_deps: for special_dep in special_deps:
print(f"pip install {special_dep}") print(f"uv pip install {special_dep}")
return return
_run_stack_build_command_from_build_config( _run_stack_build_command_from_build_config(

View file

@ -95,11 +95,11 @@ def print_pip_install_help(providers: Dict[str, List[Provider]]):
normal_deps, special_deps = get_provider_dependencies(providers) normal_deps, special_deps = get_provider_dependencies(providers)
cprint( cprint(
f"Please install needed dependencies using the following commands:\n\npip install {' '.join(normal_deps)}", f"Please install needed dependencies using the following commands:\n\nuv pip install {' '.join(normal_deps)}",
"yellow", "yellow",
) )
for special_dep in special_deps: for special_dep in special_deps:
cprint(f"pip install {special_dep}", "yellow") cprint(f"uv pip install {special_dep}", "yellow")
print() print()

View file

@ -78,10 +78,12 @@ ensure_conda_env_python310() {
eval "$(conda shell.bash hook)" eval "$(conda shell.bash hook)"
conda deactivate && conda activate "${env_name}" conda deactivate && conda activate "${env_name}"
$CONDA_PREFIX/bin/pip install uv
if [ -n "$TEST_PYPI_VERSION" ]; then if [ -n "$TEST_PYPI_VERSION" ]; then
# these packages are damaged in test-pypi, so install them first # these packages are damaged in test-pypi, so install them first
$CONDA_PREFIX/bin/pip install fastapi libcst uv pip install fastapi libcst
$CONDA_PREFIX/bin/pip install --extra-index-url https://test.pypi.org/simple/ \ uv pip install --extra-index-url https://test.pypi.org/simple/ \
llama-models==$TEST_PYPI_VERSION \ llama-models==$TEST_PYPI_VERSION \
llama-stack-client==$TEST_PYPI_VERSION \ llama-stack-client==$TEST_PYPI_VERSION \
llama-stack==$TEST_PYPI_VERSION \ llama-stack==$TEST_PYPI_VERSION \
@ -90,7 +92,7 @@ ensure_conda_env_python310() {
IFS='#' read -ra parts <<<"$special_pip_deps" IFS='#' read -ra parts <<<"$special_pip_deps"
for part in "${parts[@]}"; do for part in "${parts[@]}"; do
echo "$part" echo "$part"
$CONDA_PREFIX/bin/pip install $part uv pip install $part
done done
fi fi
else else
@ -102,7 +104,7 @@ ensure_conda_env_python310() {
fi fi
printf "Installing from LLAMA_STACK_DIR: $LLAMA_STACK_DIR\n" printf "Installing from LLAMA_STACK_DIR: $LLAMA_STACK_DIR\n"
$CONDA_PREFIX/bin/pip install --no-cache-dir -e "$LLAMA_STACK_DIR" uv pip install --no-cache-dir -e "$LLAMA_STACK_DIR"
else else
PYPI_VERSION="${PYPI_VERSION:-}" PYPI_VERSION="${PYPI_VERSION:-}"
if [ -n "$PYPI_VERSION" ]; then if [ -n "$PYPI_VERSION" ]; then
@ -110,7 +112,7 @@ ensure_conda_env_python310() {
else else
SPEC_VERSION="llama-stack" SPEC_VERSION="llama-stack"
fi fi
$CONDA_PREFIX/bin/pip install --no-cache-dir $SPEC_VERSION uv pip install --no-cache-dir $SPEC_VERSION
fi fi
if [ -n "$LLAMA_MODELS_DIR" ]; then if [ -n "$LLAMA_MODELS_DIR" ]; then
@ -120,18 +122,18 @@ ensure_conda_env_python310() {
fi fi
printf "Installing from LLAMA_MODELS_DIR: $LLAMA_MODELS_DIR\n" printf "Installing from LLAMA_MODELS_DIR: $LLAMA_MODELS_DIR\n"
$CONDA_PREFIX/bin/pip uninstall -y llama-models uv pip uninstall -y llama-models
$CONDA_PREFIX/bin/pip install --no-cache-dir -e "$LLAMA_MODELS_DIR" uv pip install --no-cache-dir -e "$LLAMA_MODELS_DIR"
fi fi
# Install pip dependencies # Install pip dependencies
printf "Installing pip dependencies\n" printf "Installing pip dependencies\n"
$CONDA_PREFIX/bin/pip install $pip_dependencies uv pip install $pip_dependencies
if [ -n "$special_pip_deps" ]; then if [ -n "$special_pip_deps" ]; then
IFS='#' read -ra parts <<<"$special_pip_deps" IFS='#' read -ra parts <<<"$special_pip_deps"
for part in "${parts[@]}"; do for part in "${parts[@]}"; do
echo "$part" echo "$part"
$CONDA_PREFIX/bin/pip install $part uv pip install $part
done done
fi fi
fi fi

View file

@ -76,6 +76,7 @@ RUN apt-get update && apt-get install -y \
bubblewrap \ bubblewrap \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN pip install uv
EOF EOF
fi fi
@ -83,7 +84,7 @@ fi
# so we can reuse layers. # so we can reuse layers.
if [ -n "$pip_dependencies" ]; then if [ -n "$pip_dependencies" ]; then
add_to_container << EOF add_to_container << EOF
RUN pip install --no-cache $pip_dependencies RUN uv pip install --no-cache $pip_dependencies
EOF EOF
fi fi
@ -91,7 +92,7 @@ if [ -n "$special_pip_deps" ]; then
IFS='#' read -ra parts <<<"$special_pip_deps" IFS='#' read -ra parts <<<"$special_pip_deps"
for part in "${parts[@]}"; do for part in "${parts[@]}"; do
add_to_container <<EOF add_to_container <<EOF
RUN pip install --no-cache $part RUN uv pip install --no-cache $part
EOF EOF
done done
fi fi
@ -109,16 +110,16 @@ if [ -n "$LLAMA_STACK_DIR" ]; then
# so that changes will be reflected in the container without having to do a # so that changes will be reflected in the container without having to do a
# rebuild. This is just for development convenience. # rebuild. This is just for development convenience.
add_to_container << EOF add_to_container << EOF
RUN pip install --no-cache -e $stack_mount RUN uv pip install --no-cache -e $stack_mount
EOF EOF
else else
if [ -n "$TEST_PYPI_VERSION" ]; then if [ -n "$TEST_PYPI_VERSION" ]; then
# these packages are damaged in test-pypi, so install them first # these packages are damaged in test-pypi, so install them first
add_to_container << EOF add_to_container << EOF
RUN pip install fastapi libcst RUN uv pip install fastapi libcst
EOF EOF
add_to_container << EOF add_to_container << EOF
RUN pip install --no-cache --extra-index-url https://test.pypi.org/simple/ \ RUN uv pip install --no-cache --extra-index-url https://test.pypi.org/simple/ \
llama-models==$TEST_PYPI_VERSION llama-stack-client==$TEST_PYPI_VERSION llama-stack==$TEST_PYPI_VERSION llama-models==$TEST_PYPI_VERSION llama-stack-client==$TEST_PYPI_VERSION llama-stack==$TEST_PYPI_VERSION
EOF EOF
@ -129,7 +130,7 @@ EOF
SPEC_VERSION="llama-stack" SPEC_VERSION="llama-stack"
fi fi
add_to_container << EOF add_to_container << EOF
RUN pip install --no-cache $SPEC_VERSION RUN uv pip install --no-cache $SPEC_VERSION
EOF EOF
fi fi
fi fi
@ -141,8 +142,8 @@ if [ -n "$LLAMA_MODELS_DIR" ]; then
fi fi
add_to_container << EOF add_to_container << EOF
RUN pip uninstall -y llama-models RUN uv pip uninstall -y llama-models
RUN pip install --no-cache $models_mount RUN uv pip install --no-cache $models_mount
EOF EOF
fi fi

View file

@ -51,17 +51,18 @@ run() {
local pip_dependencies="$2" local pip_dependencies="$2"
local special_pip_deps="$3" local special_pip_deps="$3"
pip install uv
if [ -n "$TEST_PYPI_VERSION" ]; then if [ -n "$TEST_PYPI_VERSION" ]; then
# these packages are damaged in test-pypi, so install them first # these packages are damaged in test-pypi, so install them first
pip install fastapi libcst uv pip install fastapi libcst
pip install --extra-index-url https://test.pypi.org/simple/ \ uv pip install --extra-index-url https://test.pypi.org/simple/ \
llama-models==$TEST_PYPI_VERSION llama-stack==$TEST_PYPI_VERSION \ llama-models==$TEST_PYPI_VERSION llama-stack==$TEST_PYPI_VERSION \
$pip_dependencies $pip_dependencies
if [ -n "$special_pip_deps" ]; then if [ -n "$special_pip_deps" ]; then
IFS='#' read -ra parts <<<"$special_pip_deps" IFS='#' read -ra parts <<<"$special_pip_deps"
for part in "${parts[@]}"; do for part in "${parts[@]}"; do
echo "$part" echo "$part"
pip install $part uv pip install $part
done done
fi fi
else else
@ -73,9 +74,9 @@ run() {
fi fi
printf "Installing from LLAMA_STACK_DIR: $LLAMA_STACK_DIR\n" printf "Installing from LLAMA_STACK_DIR: $LLAMA_STACK_DIR\n"
pip install --no-cache-dir -e "$LLAMA_STACK_DIR" uv pip install --no-cache-dir -e "$LLAMA_STACK_DIR"
else else
pip install --no-cache-dir llama-stack uv pip install --no-cache-dir llama-stack
fi fi
if [ -n "$LLAMA_MODELS_DIR" ]; then if [ -n "$LLAMA_MODELS_DIR" ]; then
@ -85,18 +86,18 @@ run() {
fi fi
printf "Installing from LLAMA_MODELS_DIR: $LLAMA_MODELS_DIR\n" printf "Installing from LLAMA_MODELS_DIR: $LLAMA_MODELS_DIR\n"
pip uninstall -y llama-models uv pip uninstall -y llama-models
pip install --no-cache-dir -e "$LLAMA_MODELS_DIR" uv pip install --no-cache-dir -e "$LLAMA_MODELS_DIR"
fi fi
# Install pip dependencies # Install pip dependencies
printf "Installing pip dependencies\n" printf "Installing pip dependencies\n"
pip install $pip_dependencies uv pip install $pip_dependencies
if [ -n "$special_pip_deps" ]; then if [ -n "$special_pip_deps" ]; then
IFS='#' read -ra parts <<<"$special_pip_deps" IFS='#' read -ra parts <<<"$special_pip_deps"
for part in "${parts[@]}"; do for part in "${parts[@]}"; do
echo "$part" echo "$part"
pip install $part uv pip install $part
done done
fi fi
fi fi

View file

@ -11,5 +11,5 @@ VERSION="$1"
set -euo pipefail set -euo pipefail
set -x set -x
pip install -U --extra-index-url https://test.pypi.org/simple \ uv pip install -U --extra-index-url https://test.pypi.org/simple \
llama-stack==$VERSION llama-models==$VERSION llama-stack-client==$VERSION llama-stack==$VERSION llama-models==$VERSION llama-stack-client==$VERSION

View file

@ -71,7 +71,7 @@ docker run \
### Via Conda ### Via Conda
Make sure you have done `pip install llama-stack` and have the Llama Stack CLI available. Make sure you have done `uv pip install llama-stack` and have the Llama Stack CLI available.
```bash ```bash
llama stack build --template {{ name }} --image-type conda llama stack build --template {{ name }} --image-type conda

View file

@ -73,7 +73,7 @@ docker run \
### Via Conda ### Via Conda
Make sure you have done `pip install llama-stack` and have the Llama Stack CLI available. Make sure you have done `uv pip install llama-stack` and have the Llama Stack CLI available.
```bash ```bash
llama stack build --template {{ name }} --image-type conda llama stack build --template {{ name }} --image-type conda

View file

@ -93,7 +93,7 @@ docker run \
### Via Conda ### Via Conda
Make sure you have done `pip install llama-stack` and have the Llama Stack CLI available. Make sure you have done `uv pip install llama-stack` and have the Llama Stack CLI available.
```bash ```bash
export LLAMA_STACK_PORT=5001 export LLAMA_STACK_PORT=5001

View file

@ -119,7 +119,7 @@ docker run \
### Via Conda ### Via Conda
Make sure you have done `pip install llama-stack` and have the Llama Stack CLI available. Make sure you have done `uv pip install llama-stack` and have the Llama Stack CLI available.
```bash ```bash
export INFERENCE_PORT=8000 export INFERENCE_PORT=8000

View file

@ -111,7 +111,7 @@ docker run \
### Via Conda ### Via Conda
Make sure you have done `pip install llama-stack` and have the Llama Stack CLI available. Make sure you have done `uv pip install llama-stack` and have the Llama Stack CLI available.
```bash ```bash
llama stack build --template {{ name }} --image-type conda llama stack build --template {{ name }} --image-type conda