mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 10:15:27 -04:00
The llama.cpp serve auto-install built a bare `llama-cpp-python` in the Linux source-build fallback and the Termux path, but the serve command runs `python3 -m llama_cpp.server`, which needs the `[server]` extra. Because the "already installed?" guard only checks `import llama_cpp` (a bare install satisfies it), the missing extra was never added, so serving crashed with `ModuleNotFoundError: No module named 'starlette_context'` (issue #730). - Request the `[server]` extra in both the Termux direct install and the Linux Python-bindings fallback (the Windows path already used `[server]`). - Shell-quote the package spec in `_pip_install_fallback_chain` via `shlex.quote` so the `[server]` brackets aren't treated as a bash glob; plain names unaffected. Tests: tests/test_cookbook_helpers.py gains extras-quoting coverage and a serve-runner regression guard.
This commit is contained in:
@@ -194,8 +194,13 @@ def _pip_install_fallback_chain(package: str, *, python_cmd: str = "python3 -m p
|
||||
pip output appear in the Cookbook log on failure.
|
||||
"""
|
||||
upgrade_flag = " -U" if upgrade else ""
|
||||
base = _pip_install_attempt(f"{python_cmd} install -q{upgrade_flag} {package}")
|
||||
user = _pip_install_attempt(f"{python_cmd} install --user --break-system-packages -q{upgrade_flag} {package}")
|
||||
# Shell-quote the package spec: an extras spec like ``llama-cpp-python[server]``
|
||||
# contains brackets that bash would treat as a glob, so it must be quoted
|
||||
# before being embedded in the install command. Plain names (e.g.
|
||||
# ``huggingface_hub``) are returned unchanged by ``shlex.quote``.
|
||||
pkg = shlex.quote(package)
|
||||
base = _pip_install_attempt(f"{python_cmd} install -q{upgrade_flag} {pkg}")
|
||||
user = _pip_install_attempt(f"{python_cmd} install --user --break-system-packages -q{upgrade_flag} {pkg}")
|
||||
# Derive the python executable for the venv detection check.
|
||||
# Must use the same interpreter that pip belongs to; hardcoding
|
||||
# python3 breaks when pip lives in a venv that only has "python".
|
||||
|
||||
Reference in New Issue
Block a user