mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-29 18:46:59 +00:00
fix(voice): point pip install hint at venv pip instead of system Python
When Hermes runs inside its bundled venv (~/.hermes/profiles/<name>/ 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.
This commit is contained in:
parent
a1bc12f191
commit
1605cb5fe4
1 changed files with 14 additions and 0 deletions
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue