From 62b54fd70c839867690ae96cec06ba0f4c9630dd Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Fri, 31 Jan 2025 21:38:54 -0800 Subject: [PATCH] Use `uv pip install` instead of `pip install` --- llama_stack/cli/stack/_build.py | 4 ++-- llama_stack/distribution/build.py | 4 ++-- llama_stack/distribution/build_conda_env.sh | 20 ++++++++++--------- llama_stack/distribution/build_container.sh | 17 ++++++++-------- llama_stack/distribution/build_venv.sh | 19 +++++++++--------- llama_stack/scripts/install_packages.sh | 2 +- .../meta-reference-gpu/doc_template.md | 2 +- .../doc_template.md | 2 +- llama_stack/templates/ollama/doc_template.md | 2 +- .../templates/remote-vllm/doc_template.md | 2 +- llama_stack/templates/tgi/doc_template.md | 2 +- 11 files changed, 40 insertions(+), 36 deletions(-) diff --git a/llama_stack/cli/stack/_build.py b/llama_stack/cli/stack/_build.py index 9d2976dd2..a7e2afd48 100644 --- a/llama_stack/cli/stack/_build.py +++ b/llama_stack/cli/stack/_build.py @@ -183,9 +183,9 @@ def run_stack_build_command( build_config.distribution_spec.providers ) 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: - print(f"pip install {special_dep}") + print(f"uv pip install {special_dep}") return _run_stack_build_command_from_build_config( diff --git a/llama_stack/distribution/build.py b/llama_stack/distribution/build.py index a29c8d5d1..a207143f3 100644 --- a/llama_stack/distribution/build.py +++ b/llama_stack/distribution/build.py @@ -95,11 +95,11 @@ def print_pip_install_help(providers: Dict[str, List[Provider]]): normal_deps, special_deps = get_provider_dependencies(providers) 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", ) for special_dep in special_deps: - cprint(f"pip install {special_dep}", "yellow") + cprint(f"uv pip install {special_dep}", "yellow") print() diff --git a/llama_stack/distribution/build_conda_env.sh b/llama_stack/distribution/build_conda_env.sh index 606fbf19d..3fea09ad5 100755 --- a/llama_stack/distribution/build_conda_env.sh +++ b/llama_stack/distribution/build_conda_env.sh @@ -78,10 +78,12 @@ ensure_conda_env_python310() { eval "$(conda shell.bash hook)" conda deactivate && conda activate "${env_name}" + $CONDA_PREFIX/bin/pip install uv + if [ -n "$TEST_PYPI_VERSION" ]; then # these packages are damaged in test-pypi, so install them first - $CONDA_PREFIX/bin/pip install fastapi libcst - $CONDA_PREFIX/bin/pip install --extra-index-url https://test.pypi.org/simple/ \ + uv pip install fastapi libcst + uv pip install --extra-index-url https://test.pypi.org/simple/ \ llama-models==$TEST_PYPI_VERSION \ llama-stack-client==$TEST_PYPI_VERSION \ llama-stack==$TEST_PYPI_VERSION \ @@ -90,7 +92,7 @@ ensure_conda_env_python310() { IFS='#' read -ra parts <<<"$special_pip_deps" for part in "${parts[@]}"; do echo "$part" - $CONDA_PREFIX/bin/pip install $part + uv pip install $part done fi else @@ -102,7 +104,7 @@ ensure_conda_env_python310() { fi 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 PYPI_VERSION="${PYPI_VERSION:-}" if [ -n "$PYPI_VERSION" ]; then @@ -110,7 +112,7 @@ ensure_conda_env_python310() { else SPEC_VERSION="llama-stack" fi - $CONDA_PREFIX/bin/pip install --no-cache-dir $SPEC_VERSION + uv pip install --no-cache-dir $SPEC_VERSION fi if [ -n "$LLAMA_MODELS_DIR" ]; then @@ -120,18 +122,18 @@ ensure_conda_env_python310() { fi printf "Installing from LLAMA_MODELS_DIR: $LLAMA_MODELS_DIR\n" - $CONDA_PREFIX/bin/pip uninstall -y llama-models - $CONDA_PREFIX/bin/pip install --no-cache-dir -e "$LLAMA_MODELS_DIR" + uv pip uninstall -y llama-models + uv pip install --no-cache-dir -e "$LLAMA_MODELS_DIR" fi # Install pip dependencies printf "Installing pip dependencies\n" - $CONDA_PREFIX/bin/pip install $pip_dependencies + uv pip install $pip_dependencies if [ -n "$special_pip_deps" ]; then IFS='#' read -ra parts <<<"$special_pip_deps" for part in "${parts[@]}"; do echo "$part" - $CONDA_PREFIX/bin/pip install $part + uv pip install $part done fi fi diff --git a/llama_stack/distribution/build_container.sh b/llama_stack/distribution/build_container.sh index a2820ac13..688e96dc0 100755 --- a/llama_stack/distribution/build_container.sh +++ b/llama_stack/distribution/build_container.sh @@ -76,6 +76,7 @@ RUN apt-get update && apt-get install -y \ bubblewrap \ && rm -rf /var/lib/apt/lists/* +RUN pip install uv EOF fi @@ -83,7 +84,7 @@ fi # so we can reuse layers. if [ -n "$pip_dependencies" ]; then add_to_container << EOF -RUN pip install --no-cache $pip_dependencies +RUN uv pip install --no-cache $pip_dependencies EOF fi @@ -91,7 +92,7 @@ if [ -n "$special_pip_deps" ]; then IFS='#' read -ra parts <<<"$special_pip_deps" for part in "${parts[@]}"; do add_to_container <