fix: unset PYTHONPATH to prevent Python 3.12 ABI contamination #2
Reference in New Issue
Block a user
Delete Branch "(deleted):main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix PYTHONPATH contamination causing
nextcloud-mcp-serverto 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:
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 ownsys.path— the external PYTHONPATH provides nothing useful and only causes breakage.Test Plan
nix build .#nextcloud-mcp-serversucceeds./result/bin/nextcloud-mcp-server run --transport stdio --helpworksPull request closed