Skip to content

Add one-click dependency installer with uv#24

Merged
giswqs merged 1 commit intomainfrom
add-dependency-installer
Feb 27, 2026
Merged

Add one-click dependency installer with uv#24
giswqs merged 1 commit intomainfrom
add-dependency-installer

Conversation

@giswqs
Copy link
Member

@giswqs giswqs commented Feb 27, 2026

Summary

  • Adds a cross-platform one-click dependency installer adapted from the GeoAI QGIS plugin
  • Downloads standalone Python + uv package installer, creates an isolated venv, and installs all required AI packages automatically
  • Supports NVIDIA CUDA GPU detection with automatic CPU fallback
  • Includes sam3 and its undeclared dependencies (psutil, scikit-image, scikit-learn) for Meta SAM3 support

New files

  • core/python_manager.py — Downloads standalone Python matching QGIS version from astral-sh
  • core/uv_manager.py — Downloads uv binary (pinned v0.10.6) per platform
  • core/venv_manager.py — Orchestrates venv creation and package installation (4-phase pipeline)
  • deps_install_dialog.py — QDockWidget UI with GPU detection, progress bar, install/cancel/reinstall buttons
  • workers/deps_install_worker.py — Background QThread wrapper for non-blocking installation

Modified files

  • _samgeo_lib.py — Added venv-aware path setup so get_samgeo() finds packages in the managed venv
  • samgeo_plugin.py — Gates plugin launch on dependency check; shows installer dock when deps are missing
  • metadata.txt — Bump version to 1.2.0

How it works

  1. User clicks SamGeo toolbar → plugin checks if dependencies are installed
  2. If missing, installer dock appears with GPU info and "Install Dependencies" button
  3. Installation runs in background: Python (0-10%) → uv (10-13%) → venv (13-18%) → packages (18-95%) → verify (95-100%)
  4. On success, installer dock closes and main SamGeo panel opens automatically
  5. On subsequent launches, cached venv is detected instantly (~no delay)

Test plan

  • Clean install: remove ~/.qgis_samgeo/, open QGIS, click SamGeo → installer dock appears
  • Install flow: click Install → progress bar advances → success → main dock opens
  • Model loading: select Meta SAM3, click Load Model → model loads
  • Repeat launch: close/reopen SamGeo → skips installer, goes straight to main dock
  • Cancel test: start install, click Cancel → stops, install button reappears

Adds a cross-platform dependency installer that automatically downloads
a standalone Python, the uv package installer, creates an isolated venv,
and installs all required packages (PyTorch, segment-geospatial, sam3,
transformers, etc.) with CUDA GPU support and automatic CPU fallback.

New files:
- core/python_manager.py: Downloads standalone Python from astral-sh
- core/uv_manager.py: Downloads uv binary per platform
- core/venv_manager.py: Orchestrates venv creation and package installation
- deps_install_dialog.py: QDockWidget UI with progress bar and GPU detection
- workers/deps_install_worker.py: Background QThread for installation

Modified files:
- _samgeo_lib.py: Added venv-aware path setup in get_samgeo()
- samgeo_plugin.py: Gates on dependency check, shows installer when needed
- metadata.txt: Bump version to 1.2.0
@giswqs giswqs merged commit a8fe930 into main Feb 27, 2026
1 check passed
@giswqs giswqs deleted the add-dependency-installer branch February 27, 2026 22:29
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.

1 participant