Skip to content

Commit b803a35

Browse files
authored
fix: improve missing package error messages (#149)
## Summary Improve error messages when required commands are not found by providing specific installation instructions. ## Changes - Refactor `check_package_installed()` to accept optional package name parameter - Display `uv pip install` command when `llama` is missing ## Test plan - Verify error messages display correct installation instructions when commands are missing - Confirm existing functionality works when commands are present ## Summary by CodeRabbit * **Bug Fixes** * Clearer, more actionable error messages when required build commands are missing, with optional package hints. * Reduced redundant or confusing installation prompts during pre-build checks. * **Refactor** * Unified command/installation validation into a single, consistent flow for simpler, more reliable diagnostics and output. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> Approved-by: nathan-weinberg Approved-by: rhdedgar Approved-by: skamenan7
2 parents da0c274 + 6638a7d commit b803a35

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

distribution/build.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,15 @@ def is_install_from_source(llama_stack_version):
4848
return "." not in llama_stack_version or "+rhai" in llama_stack_version
4949

5050

51-
def check_package_installed(package_name):
52-
"""Check if llama binary is installed and accessible."""
53-
if not shutil.which(package_name):
54-
print(f"Error: {package_name} not found. Please install it first.")
51+
def check_command_installed(command, package_name=None):
52+
"""Check if a command is installed and accessible."""
53+
if not shutil.which(command):
54+
if package_name:
55+
print(
56+
f"Error: {command} not found. Please run uv pip install {package_name}"
57+
)
58+
else:
59+
print(f"Error: {command} not found. Please install it.")
5560
sys.exit(1)
5661

5762

@@ -262,11 +267,10 @@ def generate_containerfile(dependencies, llama_stack_install):
262267

263268

264269
def main():
265-
check_package_installed("uv")
270+
check_command_installed("uv")
266271
install_llama_stack_from_source(LLAMA_STACK_VERSION)
267272

268-
print("Checking llama installation...")
269-
check_package_installed("llama")
273+
check_command_installed("llama", "llama-stack-client")
270274

271275
# Do not perform version check if installing from source
272276
if not is_install_from_source(LLAMA_STACK_VERSION):

0 commit comments

Comments
 (0)