diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 47bce4411..f038cf276 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -2439,8 +2439,9 @@ def _update_via_zip(args): cwd=PROJECT_ROOT, check=True, env=uv_env, ) else: - venv_pip = PROJECT_ROOT / "venv" / ("Scripts" if sys.platform == "win32" else "bin") / "pip" - pip_cmd = [str(venv_pip)] if venv_pip.exists() else ["pip"] + # Use sys.executable to explicitly call the venv's pip module, + # avoiding PEP 668 'externally-managed-environment' errors on Debian/Ubuntu + pip_cmd = [sys.executable, "-m", "pip"] try: subprocess.run(pip_cmd + ["install", "-e", ".[all]", "--quiet"], cwd=PROJECT_ROOT, check=True) except subprocess.CalledProcessError: @@ -2752,8 +2753,9 @@ def cmd_update(args): cwd=PROJECT_ROOT, check=True, env=uv_env, ) else: - venv_pip = PROJECT_ROOT / "venv" / ("Scripts" if sys.platform == "win32" else "bin") / "pip" - pip_cmd = [str(venv_pip)] if venv_pip.exists() else ["pip"] + # Use sys.executable to explicitly call the venv's pip module, + # avoiding PEP 668 'externally-managed-environment' errors on Debian/Ubuntu + pip_cmd = [sys.executable, "-m", "pip"] try: subprocess.run(pip_cmd + ["install", "-e", ".[all]", "--quiet"], cwd=PROJECT_ROOT, check=True) except subprocess.CalledProcessError: