Skip to content

fix(setup): auto-install matrix-nio during hermes setup#1978

Closed
Gutslabs wants to merge 1 commit into
NousResearch:mainfrom
Gutslabs:fix/matrix-setup-install
Closed

fix(setup): auto-install matrix-nio during hermes setup#1978
Gutslabs wants to merge 1 commit into
NousResearch:mainfrom
Gutslabs:fix/matrix-setup-install

Conversation

@Gutslabs

Copy link
Copy Markdown
Contributor

Summary

Auto-install matrix-nio during hermes setup when the user configures Matrix. Previously, setup only saved credentials to .env but never installed the required Python package, causing the gateway to fail with "matrix-nio not installed".

The Bug

  1. User runs hermes setup and configures Matrix
  2. Setup saves MATRIX_HOMESERVER, MATRIX_ACCESS_TOKEN, etc. to .env
  3. Setup never installs matrix-nio — just prints a manual hint
  4. User starts gateway → crash: "matrix-nio not installed"
  5. Additionally, matrix-nio was not included in the [all] extra in pyproject.toml, so even pip install hermes-agent[all] didn't install it

The Fix

  • Added auto-install logic to the Matrix setup block in hermes_cli/setup.py, following the same pattern already used by Modal (swe-rex[modal]) and Daytona backends: try: import nio / except ImportError: subprocess.run(uv pip install ...)
  • Installs matrix-nio[e2e] when E2EE is enabled, plain matrix-nio otherwise
  • Falls back to pip install if uv is not available
  • Added hermes-agent[matrix] to the [all] extra in pyproject.toml

Test Plan

  • Run hermes setup, configure Matrix, verify matrix-nio is installed automatically
  • Verify gateway starts successfully after setup
  • Verify pip install hermes-agent[all] now includes matrix-nio

Closes #1973

When a user configures Matrix during `hermes setup`, the setup wizard
saved credentials to .env but never installed the required matrix-nio
package. The gateway then failed to start with "matrix-nio not installed".

This follows the same auto-install pattern already used by Modal and
Daytona backends: try to import the package, and if missing, install it
via uv pip (or pip fallback). Installs matrix-nio[e2e] when E2EE is
enabled, plain matrix-nio otherwise.

Also adds the matrix extra to pyproject.toml [all] so that
`pip install hermes-agent[all]` includes matrix-nio.
@fanningert

Copy link
Copy Markdown

@Gutslabs I think you forgot one line in the beginning of the file "setup.py".

import shutil

without this line I get following error

uv_bin = shutil.which("uv")

NameError: name 'shutil' is not defined

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Matrix messaging channel not functional

2 participants