Skip to content

fix(termux): prebuild psutil compatibility shim in setup-hermes.sh - #72571

Open
bradlishman wants to merge 1 commit into
NousResearch:mainfrom
bradlishman:fix/termux-setup-hermes-psutil-shim
Open

fix(termux): prebuild psutil compatibility shim in setup-hermes.sh#72571
bradlishman wants to merge 1 commit into
NousResearch:mainfrom
bradlishman:fix/termux-setup-hermes-psutil-shim

Conversation

@bradlishman

Copy link
Copy Markdown

What does this PR do?

Fixes setup-hermes.sh (the manual dev quick-setup script) so it doesn't silently produce a broken install on Termux/Android.

On Termux, setup-hermes.sh currently jumps straight from creating the venv to pip install -e ".[termux]" -c constraints-termux.txt. Because upstream psutil's setup.py rejects sys.platform == "android" before the build even starts, that install fails on psutil with platform android is not supported — the exact symptom in #31415. The script's own -e (set -e) doesn't catch this because the pip call is chained with || into a fallback that also fails, and the overall script still exits 0, leaving a venv containing only pip/wheel/setuptools and no actual hermes command.

scripts/install.sh (the one-line curl | bash installer) already works around this: it prebuilds psutil via the repo's own scripts/install_psutil_android.py shim before the [termux] install. setup-hermes.sh never got the equivalent step, so anyone following "Quick setup for developers who cloned the repo manually" on Termux hits this.

Related Issue

Fixes #31415

Note: #44390 (open) already fixes the documented manual step-by-step guide in website/docs/getting-started/termux.md to include the psutil shim step. That guide never mentions setup-hermes.sh, so this PR is a separate, non-overlapping fix for the convenience script itself — confirmed no open PR currently touches setup-hermes.sh's Termux branch.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • setup-hermes.sh: on Termux, detect sys.platform == "android" and run scripts/install_psutil_android.py (mirroring install.sh's existing guard and warning message) before the [termux] pip install.

How to Test

  1. On a fresh Termux checkout of this branch: rm -rf venv && ./setup-hermes.sh
  2. Without this fix, the install log shows ERROR: Failed to build 'psutil' when getting requirements to build wheel and the script still exits 0 with venv/bin/ containing no hermes entry point.
  3. With this fix, Android Python detected: prebuilding psutil compatibility shim... prints before the [termux] install, pip install -e ".[termux]" succeeds, and hermes --version / hermes doctor work afterward.

Checklist

Code

Documentation & Housekeeping

  • N/A — no config keys, architecture, or tool schema changes; website/docs/getting-started/termux.md doesn't reference setup-hermes.sh so no doc update needed here

setup-hermes.sh (the manual dev quick-setup script) jumps straight to
`pip install -e ".[termux]"` on Termux, so a fresh clone fails with
"platform android is not supported" when pip tries to build psutil
from its sdist -- the same failure reported in #31415.

scripts/install.sh already works around this by prebuilding psutil
via scripts/install_psutil_android.py before the main package install
(see install.sh's Android psutil prebuild step). setup-hermes.sh never
picked up the equivalent step, so `./setup-hermes.sh` silently leaves
the venv without the actual hermes-agent package or its CLI entry
point installed.

Mirror install.sh's guard: detect sys.platform == "android" and run
the psutil shim before the [termux] install, with the same warning
message on failure.

Fixes #31415
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard area/install-update Installer, updater, packaging, wheels, doctor P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #31415 and #44390: this repairs setup-hermes.sh itself, whereas #44390 covers the manual Termux guide.

bradlishman added a commit to bradlishman/hermes-agent that referenced this pull request Jul 27, 2026
…tup-hermes.sh

Merges the setup-hermes.sh fix from NousResearch/hermes-agent#72571
into local main and the bradlishman/hermes-agent fork's main, ahead
of upstream maintainer review/merge (read-only access to origin).
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for covering the separate setup-hermes.sh path.

Problems

  • The reported exit-0 behavior is not supported by the current script's set -e at setup-hermes.sh:20; a matching false || { false; } Bash reproduction exits 1. The substantive gap remains real: setup-hermes.sh:196-203 reaches the Termux pip install without the Android psutil shim.

Suggested changes

  • Update the PR description/test expectation to target the missing prebuild ordering rather than a successful exit after two failed package installs. The added invocation otherwise mirrors the established installer implementation at scripts/install.sh:1450-1455.

Automated hermes-sweeper review.

@teknium1 teknium1 added the sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users label Jul 30, 2026

@GottZ GottZ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Summary

Three PRs address or reference #31415 across distinct Termux installation paths: #22901 added the Android psutil shim to the supported installer and update flow, #44390 adds the missing shim and 32-bit Rust-target guidance to the manual documentation, and #72571 invokes the existing shim from the cloned-repository quick-setup script.

Related pull requests

  • #22901 [merged] partial — (+281/-32) — merged reference implementation: it introduced scripts/install_psutil_android.py and wired the psutil prebuild into fresh installs and updates, directly handling psutil's Android platform rejection; it remains relevant because the other PRs extend that established workaround to paths it did not cover.
  • #44390 best fix — (+120/-11) — keep open with a salvage path: the diff places the existing psutil shim before pip installation in both manual guides, adds the reported armv8l Rust-target workaround, and tests those ordering and architecture invariants. This matches the keep_open review on #44390 and addresses the documentation path rather than duplicating the installer implementation.
  • #72571 partial — (+14/-0) — keep open with a salvage path: the diff adds the established Android-only psutil prebuild before setup-hermes.sh's Termux pip command, covering a separate executable path from #44390. This matches the keep_open review on #72571, but the PR description should drop its unsupported claim that both failed installs leave the script exiting 0; the verified gap is the missing prebuild ordering.

Suggested consolidation

Keep #44390 open for the manual-guide and regression-test salvage path, and keep #72571 open for the separate setup-hermes.sh salvage path after correcting its exit-status rationale. #22901 is the merged reference implementation, not a duplicate to revisit; #44390 and #72571 should not be closed as duplicates because they modify non-overlapping user paths.

Complex graph

flowchart LR
    classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
    classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
    classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
    classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
    classDef best stroke-width:3px,stroke:#b45309
    classDef target stroke-width:3px,stroke:#4338ca
    I31415(["issue #31415 (open)"])
    P72571["PR #72571 (open)"]
    P72571 -.->|partial| I31415
    class I31415 open
    class P72571 open
    class P72571 target
    click I31415 "https://github.com/NousResearch/hermes-agent/issues/31415"
    click P72571 "https://github.com/NousResearch/hermes-agent/pull/72571"
Loading

Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label).

Cross-PR triage: Reviewed 3 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 30 kB of PR diffs, 12 kB of issue/PR text, 18 kB of discussion (12 comments), 4 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Setup]: Failed to install on Android with termux, reporting failed to build psutil

4 participants