Skip to content

Commit

Permalink
fix: llama stack build use UV_SYSTEM_PYTHON to install dependencies t…
Browse files Browse the repository at this point in the history
…o system environment (#1163)

# What does this PR do?
- resolves issue: #1159 
- Root cause: #980 forces
`build_venv.sh` to install in a venv environment, which do not work on
Colab notebook environment

<img width="1004" alt="image"
src="https://github.com/user-attachments/assets/1f9be409-5313-4926-b078-74e141cf29eb"
/>

## This PR
Use `UV_SYSTEM_PYTHON` to make sure dependencies are installed in
current system environment. Which will be used in the Colab environment.
```
UV_SYSTEM_PYTHON=1 llama stack build --template together --image-type venv
```

## Test Plan
- Works in Colab environment
<img width="621" alt="image"
src="https://github.com/user-attachments/assets/ae93bc3d-e05a-44b9-bb21-fb88f29969b8"
/>
  • Loading branch information
yanxi0830 authored Feb 20, 2025
1 parent 2b752df commit 61f43b8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions llama_stack/distribution/build_venv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ run() {
local env_name="$1"
local pip_dependencies="$2"
local special_pip_deps="$3"

if [ -n "${UV_SYSTEM_PYTHON:-}" ]; 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
Expand Down

0 comments on commit 61f43b8

Please sign in to comment.