diff --git a/llama_stack/cli/stack/configure.py b/llama_stack/cli/stack/configure.py index 7a1cbdf98..7fbfaf769 100644 --- a/llama_stack/cli/stack/configure.py +++ b/llama_stack/cli/stack/configure.py @@ -39,7 +39,9 @@ class StackConfigure(Subcommand): ) def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None: + import json import os + import subprocess from pathlib import Path import pkg_resources @@ -65,18 +67,19 @@ class StackConfigure(Subcommand): f"Could not find {build_config_file}. Trying conda build name instead...", color="green", ) - if os.getenv("CONDA_PREFIX", ""): - conda_dir = ( - Path(os.getenv("CONDA_PREFIX")).parent / f"llamastack-{args.config}" - ) - else: - cprint( - "Cannot find CONDA_PREFIX. Trying default conda path ~/.conda/envs...", - color="green", - ) - conda_dir = ( - Path(os.path.expanduser("~/.conda/envs")) / f"llamastack-{args.config}" - ) + + conda_dir = ( + Path(os.path.expanduser("~/.conda/envs")) / f"llamastack-{args.config}" + ) + output = subprocess.check_output( + ["bash", "-c", "conda info --json -a | jq '.envs'"] + ) + conda_envs = json.loads(output.decode("utf-8")) + + for x in conda_envs: + if x.endswith(f"/llamastack-{args.config}"): + conda_dir = Path(x) + break build_config_file = Path(conda_dir) / f"{args.config}-build.yaml" diff --git a/tests/examples/local-run.yaml b/tests/examples/local-run.yaml index 94340c4d1..e4319750a 100644 --- a/tests/examples/local-run.yaml +++ b/tests/examples/local-run.yaml @@ -1,7 +1,7 @@ built_at: '2024-09-23T00:54:40.551416' -image_name: test-2 +image_name: local docker_image: null -conda_env: test-2 +conda_env: local apis_to_serve: - shields - agents @@ -34,12 +34,12 @@ routing_table: inference: - provider_type: meta-reference config: - model: Meta-Llama3.1-8B-Instruct + model: Llama3.1-8B-Instruct quantization: null torch_seed: null max_seq_len: 4096 max_batch_size: 1 - routing_key: Meta-Llama3.1-8B-Instruct + routing_key: Llama3.1-8B-Instruct safety: - provider_type: meta-reference config: