mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
do not assume CONDA_PREFIX exists during configuration
This commit is contained in:
parent
8fa49593e0
commit
7e9e6117e3
1 changed files with 14 additions and 14 deletions
|
@ -39,18 +39,16 @@ class StackConfigure(Subcommand):
|
||||||
)
|
)
|
||||||
|
|
||||||
def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None:
|
def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None:
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
from termcolor import cprint
|
||||||
|
|
||||||
from llama_stack.distribution.build import ImageType
|
from llama_stack.distribution.build import ImageType
|
||||||
|
|
||||||
from llama_stack.distribution.utils.exec import run_with_pty
|
from llama_stack.distribution.utils.exec import run_with_pty
|
||||||
from termcolor import cprint
|
|
||||||
|
|
||||||
docker_image = None
|
docker_image = None
|
||||||
|
|
||||||
|
@ -67,15 +65,18 @@ class StackConfigure(Subcommand):
|
||||||
f"Could not find {build_config_file}. Trying conda build name instead...",
|
f"Could not find {build_config_file}. Trying conda build name instead...",
|
||||||
color="green",
|
color="green",
|
||||||
)
|
)
|
||||||
conda_dir = Path(os.getenv("CONDA_PREFIX")).parent / f"llamastack-{args.config}"
|
if os.getenv("CONDA_PREFIX"):
|
||||||
build_config_file = Path(conda_dir) / f"{args.config}-build.yaml"
|
conda_dir = (
|
||||||
|
Path(os.getenv("CONDA_PREFIX")).parent / f"llamastack-{args.config}"
|
||||||
|
)
|
||||||
|
build_config_file = Path(conda_dir) / f"{args.config}-build.yaml"
|
||||||
|
|
||||||
if build_config_file.exists():
|
if build_config_file.exists():
|
||||||
with open(build_config_file, "r") as f:
|
with open(build_config_file, "r") as f:
|
||||||
build_config = BuildConfig(**yaml.safe_load(f))
|
build_config = BuildConfig(**yaml.safe_load(f))
|
||||||
|
|
||||||
self._configure_llama_distribution(build_config, args.output_dir)
|
self._configure_llama_distribution(build_config, args.output_dir)
|
||||||
return
|
return
|
||||||
|
|
||||||
# if we get here, we need to try to find the docker image
|
# if we get here, we need to try to find the docker image
|
||||||
cprint(
|
cprint(
|
||||||
|
@ -120,12 +121,11 @@ class StackConfigure(Subcommand):
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from llama_stack.distribution.configure import configure_api_providers
|
|
||||||
|
|
||||||
from llama_stack.distribution.utils.exec import run_with_pty
|
|
||||||
from llama_stack.distribution.utils.serialize import EnumEncoder
|
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
|
||||||
|
from llama_stack.distribution.configure import configure_api_providers
|
||||||
|
from llama_stack.distribution.utils.serialize import EnumEncoder
|
||||||
|
|
||||||
builds_dir = BUILDS_BASE_DIR / build_config.image_type
|
builds_dir = BUILDS_BASE_DIR / build_config.image_type
|
||||||
if output_dir:
|
if output_dir:
|
||||||
builds_dir = Path(output_dir)
|
builds_dir = Path(output_dir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue