From 7c7e13734de0af36d1ea794941a169201d30963f Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Wed, 19 Feb 2025 16:47:29 -0800 Subject: [PATCH] temp add --- llama_stack/distribution/build.py | 2 ++ llama_stack/distribution/build_venv.sh | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/llama_stack/distribution/build.py b/llama_stack/distribution/build.py index 511817de8..a22d04a86 100644 --- a/llama_stack/distribution/build.py +++ b/llama_stack/distribution/build.py @@ -122,11 +122,13 @@ def build_image( " ".join(normal_deps), ] elif build_config.image_type == ImageType.venv.value: + system_install = True script = str(importlib.resources.files("llama_stack") / "distribution/build_venv.sh") args = [ script, str(image_name), " ".join(normal_deps), + str(system_install), ] if special_deps: diff --git a/llama_stack/distribution/build_venv.sh b/llama_stack/distribution/build_venv.sh index 0b0bffcfd..e24861582 100755 --- a/llama_stack/distribution/build_venv.sh +++ b/llama_stack/distribution/build_venv.sh @@ -37,6 +37,9 @@ build_name="$1" env_name="llamastack-$build_name" pip_dependencies="$2" +# whether we want to install dependencies in current system python environment +system_install="$4" + # Define color codes RED='\033[0;31m' NC='\033[0m' # No Color @@ -73,11 +76,17 @@ run() { local env_name="$1" local pip_dependencies="$2" local special_pip_deps="$3" + local system_install="$4" + + if [ "$SYSTEM_INSTALL" = true ]; then + echo "Installing dependencies in system Python environment" + else + echo "Using virtual environment $env_name" + uv venv "$env_name" + # shellcheck source=/dev/null + source "$env_name/bin/activate" + fi - echo "Using virtual environment $env_name" - uv venv "$env_name" - # shellcheck source=/dev/null - source "$env_name/bin/activate" if [ -n "$TEST_PYPI_VERSION" ]; then # these packages are damaged in test-pypi, so install them first uv pip install fastapi libcst