Force Linux venv onto OS Python so apt _gi loads

uv was recreating .venv with managed CPython 3.12.2 (from .python-version),
which cannot import apt python3-gi's _gi. Pin .python-version to 3.12, create
and sync the venv with --no-managed-python using /usr/bin/python3, fail setup
if GTK is still unusable, and document the ABI mismatch.

Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-07-25 05:54:59 +00:00
parent cf08d35767
commit b9ea8b2d36
5 changed files with 78 additions and 31 deletions

View File

@@ -76,9 +76,10 @@ chmod +x desktop/setup_linux.sh
./desktop/setup_linux.sh
```
That installs apt GTK/WebKit packages if needed, recreates `.venv` with
`--system-site-packages` (so `python3-gi` is visible), runs `uv sync`, and
creates a Desktop shortcut.
That installs apt GTK/WebKit packages if needed, recreates `.venv` with the
**OS** `/usr/bin/python3` (`--no-managed-python --system-site-packages` so apt
`python3-gi` / `_gi` loads), runs `uv sync`, and creates a Desktop shortcut.
Do not use a uv-managed CPython for the Linux native window — `_gi` will fail.
**Manual / macOS** (deps only; on Linux this alone is not enough for a native window):
@@ -100,7 +101,9 @@ Manual equivalent:
sudo apt install python3-gi gir1.2-gtk-3.0 gir1.2-webkit2-4.1
rm -rf .venv
uv venv --python python3 --system-site-packages
# Must be OS python3 — `uv venv --python python3` may pick a managed build
# that cannot load apt _gi.
uv venv --python /usr/bin/python3 --no-managed-python --system-site-packages
uv sync
.venv/bin/python -m xlsx_clean.web_app
@@ -169,7 +172,7 @@ Windows CLI helper: `src\xlsx_clean\new_xslx.bat`
|------|---------|
| `desktop/xlsx-clean.ico` | Modern Windows Desktop / exe icon |
| `desktop/Setup.bat` | Windows one-time setup via uv + Desktop shortcut |
| `desktop/setup_linux.sh` | Linux one-time setup (apt + system-site-packages venv + shortcut) |
| `desktop/setup_linux.sh` | Linux one-time setup (apt + OS Python venv + shortcut) |
| `desktop/Install-DesktopShortcut.bat` | Create Desktop icon only (Windows) |
| `desktop/XlsxClean.vbs` | Silent double-click launcher |
| `desktop/XlsxClean.bat` | Launcher with visible console |