Skip to content

The agent that grows with you

fix(voice): point pip install hint at venv pip instead of system Python

RedClaus1605cb5fe4bb
diff --git a/tools/voice_mode.py b/tools/voice_mode.py
index 7744d99b4c8..db491d26e35 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/<name>/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"