From 1605cb5fe4bb2941694e14190872d9d263eb80b9 Mon Sep 17 00:00:00 2001 From: RedClaus Date: Mon, 20 Jul 2026 20:59:00 -0400 Subject: [PATCH] fix(voice): point pip install hint at venv pip instead of system Python MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Hermes runs inside its bundled venv (~/.hermes/profiles// hermes-agent/venv/), the bare 'pip install sounddevice numpy' hint in _voice_capture_install_hint() told users to install into whichever Python their shell resolves first — on macOS that is often the system Python under Rosetta, a completely separate site-packages tree with incompatible wheel arches. Detect venv via sys.prefix != sys.base_prefix and return the full path to the venv's pip binary (Path(sys.prefix)/bin/pip) when available. Falls back to the bare hint outside a venv (e.g. bare-metal installs). Also adds 'from pathlib import Path' which was the only new import. --- tools/voice_mode.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/voice_mode.py b/tools/voice_mode.py index 7744d99b4c8d..db491d26e352 100644 --- a/tools/voice_mode.py +++ b/tools/voice_mode.py @@ -18,6 +18,7 @@ import shlex import shutil import subprocess import sys +from pathlib import Path import tempfile import threading import time @@ -122,6 +123,19 @@ from hermes_constants import is_termux as _is_termux_environment def _voice_capture_install_hint() -> str: if _is_termux_environment(): return "pkg install python-numpy portaudio && python -m pip install sounddevice" + # If we're running inside a venv (e.g. the bundled Hermes venv at + # ~/.hermes/profiles//hermes-agent/venv/), `pip install` on the + # user's PATH won't reach the right site-packages — the bare hint sends + # them off to whichever Python their shell resolves first, which on macOS + # is often a system Python under Rosetta with a totally separate wheel + # index. Point them at the actual interpreter pip is sitting next to. + try: + if sys.prefix != getattr(sys, "base_prefix", sys.prefix): + pip_in_venv = Path(sys.prefix) / "bin" / "pip" + if pip_in_venv.exists(): + return f"{pip_in_venv} install sounddevice numpy" + except Exception: + pass return "pip install sounddevice numpy"