Skip to content

fix(installer): detect system Python with PyGObject and isolate launcher - #50

Closed
sud33p wants to merge 93 commits into
srinivasr:mainfrom
sud33p:fix/system-python-detection-in-installer
Closed

sud33p wants to merge 93 commits into
srinivasr:mainfrom
sud33p:fix/system-python-detection-in-installer

Conversation

@sud33p

@sud33p sud33p commented Sep 18, 2026

Copy link
Copy Markdown

Summary

When users have a user-level Python version manager active (e.g., Mise, pyenv, asdf, conda), python3 in $PATH resolves to a user-managed Python build that lacks system PyGObject (gi) bindings. Host package managers (pacman -S python-gobject, apt install python3-gi, dnf install python3-gobject, etc.) install those bindings into the system Python (e.g., /usr/bin/python3).

This currently leads to two failure modes when running install.sh:

  1. install.sh uses ambient python3 to test for gi and creates the venv. When a version manager is active, python3 -c "import gi" fails, causing the installer to abort with PyGObject is NOT installed on your host system even after the system package was successfully installed.
  2. The generated launcher script executes uv run python3 -m nirimod "$@". In shells or desktop sessions where a Python manager is active, ambient python3 is invoked again, failing with No module named nirimod or missing gi.

Proposed Changes

  • Added helper find_host_python_with_gi which checks ambient python3 first, then falls back to standard system paths (/usr/bin/python3, /usr/bin/python, /usr/local/bin/python3) to find the interpreter where gi is actually available.
  • Used the detected Python interpreter when creating the virtualenv with run_uv venv --system-site-packages --python "$target_python".
  • Pointed the generated launcher script directly to "$INSTALL_DIR/.venv/bin/python" -m nirimod "$@", ensuring it runs within the configured virtual environment regardless of ambient $PATH shims.

Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
Resolves srinivasr#1

Signed-off-by: srinivasr <sriniv4sreddy@gmail.com>
srinivasr and others added 27 commits May 9, 2026 15:28
- Fix crash when niri returns null logical for disabled outputs
- Add canvas refresh and in-memory data supply from KDL config
- Refresh outputs page after save so canvas updates with live data
* fix(outputs): round fractional snaps outward

* fix(outputs): ignore distant snap candidates

* test(outputs): skip without gtk bindings
* fix(config): preserve symlinks when saving

* fix(config): preserve file permissions
- show exclude nodes in rule summary (fixes srinivasr#45)
- fixed missing short labels for symbol keys
When users have a user-level Python version manager active (e.g. mise,
pyenv, asdf, conda), python3 in PATH is an isolated build without
system PyGObject (gi) bindings, which are installed via the OS package
manager into system Python (e.g. /usr/bin/python3).

This change:
1. Adds find_host_python_with_gi to inspect ambient python3 first, falling
   back to standard system paths (/usr/bin/python3, /usr/bin/python) if ambient
   python lacks gi.
2. Uses the detected Python when creating the virtualenv with --system-site-packages.
3. Points the generated launcher directly to $INSTALL_DIR/.venv/bin/python to
   prevent ambient PATH shims from hijacking the runtime when launched from user shells
   or desktop sessions.
@srinivasr srinivasr closed this Sep 18, 2026
@sud33p
sud33p deleted the fix/system-python-detection-in-installer branch September 18, 2026 20:51
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.