hermes - 💡(How to fix) Fix hermes update fails with 'No virtual environment found' when launcher venv is not active in shell

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

error: No virtual environment found; run uv venv to create an environment, or pass --system to install into a non-virtual environment ✗ Update failed

Root Cause

Root cause: The launcher shim at ~/.local/bin/hermes uses the venv's interpreter via shebang (#!/Users/jon/.hermes/hermes-agent/venv/bin/python) but does not export VIRTUAL_ENV or prepend the venv bin to PATH. So sys.prefix is correctly set inside the Python process, but a subprocess invoked from that process doesn't inherit the venv context.

Fix Action

Fix / Workaround

Workaround: VIRTUAL_ENV=~/.hermes/hermes-agent/venv PATH=~/.hermes/hermes-agent/venv/bin:$PATH hermes update succeeds.

Code Example

error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
Update failed

---

uv = shutil.which("uv")
if uv:
    cmd = [uv, "pip", "install", "--upgrade", "hermes-agent"]
else:
    cmd = [sys.executable, "-m", "pip", "install", "--upgrade", "hermes-agent"]

print(f"→ Running: {' '.join(cmd)}")
result = subprocess.run(cmd)

---

env = {**os.environ, "VIRTUAL_ENV": sys.prefix}
result = subprocess.run(cmd, env=env)
RAW_BUFFERClick to expand / collapse

Environment: macOS, hermes installed via the install.sh flow that creates ~/.hermes/hermes-agent/venv/ and a launcher shim at ~/.local/bin/hermes. uv is the chosen packager.

Symptom: hermes update fails immediately from any shell that doesn't have VIRTUAL_ENV set, with:

error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
✗ Update failed

Reproduced from a regular interactive zsh on the same machine where hermes is otherwise running fine (gateway up, status OK).

Root cause: The launcher shim at ~/.local/bin/hermes uses the venv's interpreter via shebang (#!/Users/jon/.hermes/hermes-agent/venv/bin/python) but does not export VIRTUAL_ENV or prepend the venv bin to PATH. So sys.prefix is correctly set inside the Python process, but a subprocess invoked from that process doesn't inherit the venv context.

In _cmd_update_pip at hermes_cli/main.py:8888-8907, the update path shells out:

uv = shutil.which("uv")
if uv:
    cmd = [uv, "pip", "install", "--upgrade", "hermes-agent"]
else:
    cmd = [sys.executable, "-m", "pip", "install", "--upgrade", "hermes-agent"]

print(f"→ Running: {' '.join(cmd)}")
result = subprocess.run(cmd)

The subprocess.run(cmd) inherits the parent env, which doesn't include VIRTUAL_ENV. uv refuses to install without it, so the update aborts.

Workaround: VIRTUAL_ENV=~/.hermes/hermes-agent/venv PATH=~/.hermes/hermes-agent/venv/bin:$PATH hermes update succeeds.

Suggested fix: In _cmd_update_pip, propagate the launcher's venv to the subprocess via sys.prefix:

env = {**os.environ, "VIRTUAL_ENV": sys.prefix}
result = subprocess.run(cmd, env=env)

sys.prefix is automatically the venv root when the interpreter was launched via a venv shebang (the install.sh launcher pattern), so this single-line change covers the common case without breaking system-Python installs (where sys.prefix is the system prefix and uv accepts it via --system or the VIRTUAL_ENV shortcut won't apply anyway — same effective behavior as now).

Related: this is the same install pattern that the launchd plist regeneration assumes (see #28135 for the unrelated launchd KeepAlive bug), so the venv discovery story should be consistent across hermes update and hermes gateway.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix hermes update fails with 'No virtual environment found' when launcher venv is not active in shell