From 7f9b76727724c926b7efb50c523713cdb692d438 Mon Sep 17 00:00:00 2001 From: Dinesh Yeduguru Date: Thu, 27 Feb 2025 23:07:23 -0800 Subject: [PATCH] fix: check conda env name using basepath in exec.py (#1301) # What does this PR do? check conda env name using basepath in exec.py The current logic for finding conda prefix does a `endswith` check with just the conda env name, but this will cause us to match incorrect if there is a different conda env which ends with same suffix. In my case, i had stack and llama-stack as the two conda envs. ## Test Plan llama stack run ~/.llama/distributions/fireworks/fireworks-run.yaml --- llama_stack/distribution/utils/exec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama_stack/distribution/utils/exec.py b/llama_stack/distribution/utils/exec.py index 82bf00e3c..aae6b35d8 100644 --- a/llama_stack/distribution/utils/exec.py +++ b/llama_stack/distribution/utils/exec.py @@ -46,7 +46,7 @@ def formulate_run_args(image_type, image_name, config, template_name) -> list: conda_env_info = json.loads(subprocess.check_output(["conda", "info", "--envs", "--json"]).decode()) envs = conda_env_info["envs"] for envpath in envs: - if envpath.endswith(env_name): + if os.path.basename(envpath) == env_name: return envpath return None