fix: unset PYTHONPATH to prevent Python 3.12 ABI contamination #2

Closed
hermes-agent wants to merge 1 commits from (deleted):main into main
Collaborator

Summary

Fix PYTHONPATH contamination causing nextcloud-mcp-server to crash on startup with C extension ABI mismatches.

Problem

The Nix-built binary works perfectly in a clean environment, but when launched by Hermes Agent (which inherits the system's PYTHONPATH from the mautrix Matrix bridge and other Python 3.12 services), the Python 3.13 wrapper picks up Python 3.12 site-packages. This causes:

ImportError: cannot import name '_imaging' from 'PIL'
  (/nix/store/...-python3.12-pillow-12.2.0/lib/python3.12/site-packages/PIL/__init__.py)

The root cause: Python 3.13 can't load C extensions compiled for Python 3.12.

Fix

Add makeWrapperArgs = [ "--unset" "PYTHONPATH" ] to the derivation. The wrapper already has the full correct closure in its own sys.path — the external PYTHONPATH provides nothing useful and only causes breakage.

Test Plan

  • nix build .#nextcloud-mcp-server succeeds
  • ./result/bin/nextcloud-mcp-server run --transport stdio --help works
  • MCP server starts correctly when launched by Hermes Agent
## Summary Fix PYTHONPATH contamination causing `nextcloud-mcp-server` to crash on startup with C extension ABI mismatches. ## Problem The Nix-built binary works perfectly in a clean environment, but when launched by Hermes Agent (which inherits the system's PYTHONPATH from the mautrix Matrix bridge and other Python 3.12 services), the Python 3.13 wrapper picks up Python 3.12 site-packages. This causes: ``` ImportError: cannot import name '_imaging' from 'PIL' (/nix/store/...-python3.12-pillow-12.2.0/lib/python3.12/site-packages/PIL/__init__.py) ``` The root cause: Python 3.13 can't load C extensions compiled for Python 3.12. ## Fix Add `makeWrapperArgs = [ "--unset" "PYTHONPATH" ]` to the derivation. The wrapper already has the full correct closure in its own `sys.path` — the external PYTHONPATH provides nothing useful and only causes breakage. ## Test Plan - [ ] `nix build .#nextcloud-mcp-server` succeeds - [ ] `./result/bin/nextcloud-mcp-server run --transport stdio --help` works - [ ] MCP server starts correctly when launched by Hermes Agent
hermes-agent added 1 commit 2026-05-28 09:14:35 +02:00
fix: unset PYTHONPATH in nextcloud-mcp-server wrapper
Some checks failed
CI / Flake Check (pull_request) Has been cancelled
CI / Build Individual Packages (academic-search-mcp-server) (pull_request) Has been cancelled
CI / Build Individual Packages (duckduckgo-mcp-server) (pull_request) Has been cancelled
CI / Build Individual Packages (kindly-web-search-mcp-server) (pull_request) Has been cancelled
CI / Build Individual Packages (manim-mcp-server) (pull_request) Has been cancelled
CI / Build Individual Packages (pdf-reader-mcp) (pull_request) Has been cancelled
CI / Build Individual Packages (rust-research-mcp) (pull_request) Has been cancelled
CI / Build Individual Packages (zotero-mcp) (pull_request) Has been cancelled
28ac86d81f
Prevents Python 3.12 site-packages (from host env like mautrix bridge) from contaminating the Python 3.13 wrapper, causing C extension ABI mismatches (e.g. PIL._imaging).
hermes-agent closed this pull request 2026-05-28 09:14:46 +02:00
Some checks failed
CI / Flake Check (pull_request) Has been cancelled
CI / Build Individual Packages (academic-search-mcp-server) (pull_request) Has been cancelled
CI / Build Individual Packages (duckduckgo-mcp-server) (pull_request) Has been cancelled
CI / Build Individual Packages (kindly-web-search-mcp-server) (pull_request) Has been cancelled
CI / Build Individual Packages (manim-mcp-server) (pull_request) Has been cancelled
CI / Build Individual Packages (pdf-reader-mcp) (pull_request) Has been cancelled
CI / Build Individual Packages (rust-research-mcp) (pull_request) Has been cancelled
CI / Build Individual Packages (zotero-mcp) (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: luis/mcp-servers#2