Skip to content

Fix macOS QGIS dependency installer - #11

Merged
giswqs merged 5 commits into
mainfrom
fix/macos-qgis-managed-python-qgis-plugin-template
May 8, 2026
Merged

Fix macOS QGIS dependency installer#11
giswqs merged 5 commits into
mainfrom
fix/macos-qgis-managed-python-qgis-plugin-template

Conversation

@giswqs

@giswqs giswqs commented May 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Reject macOS QGIS app-bundle Python wrappers for dependency virtual environment creation where this plugin manages dependency venvs.
  • Use uv-managed Python when no safe local Python interpreter is available.
  • Bump the QGIS plugin patch version in metadata.txt.

Root Cause

Official macOS QGIS installer builds can expose Python wrappers inside QGIS*.app/Contents/MacOS that either fail to start outside QGIS or create virtual environments pointing at the QGIS CI build prefix. Those venvs fail during dependency installation with missing stdlib modules such as encodings.

Validation

  • python -m py_compile on the changed dependency manager
  • Focused local QGIS plugin tests were run from the source checkout before publishing these PRs.

Copilot AI review requested due to automatic review settings May 8, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the dependency/venv creation logic for macOS QGIS installs to avoid using problematic Python executables inside the QGIS .app bundle, and to fall back to uv-managed Python where needed.

Changes:

  • Add detection for Python executables located in a QGIS macOS .app bundle and exclude them from interpreter selection.
  • Update create_venv() to prefer uv venv, using --managed-python when no safe local Python interpreter can be found.
  • Preserve the existing pip-based venv creation strategies for cases where a suitable local interpreter is available.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin_template/deps_manager.py Outdated
Comment on lines +215 to +223
"""Return True for Python binaries inside a QGIS macOS .app bundle."""
if not (platform.system() == "Darwin" or sys.platform == "darwin"):
return False
parts = os.path.abspath(path).split(os.sep)
for idx, part in enumerate(parts):
lower = part.lower()
if not (lower.startswith("qgis") and lower.endswith(".app")):
continue
return idx + 1 < len(parts) and parts[idx + 1] == "Contents"
Comment thread plugin_template/deps_manager.py Outdated
python_exe = _find_python_executable()
subprocess_error = ""
if python_exe is None:
raise RuntimeError(python_lookup_error)
@giswqs
giswqs merged commit a5c42aa into main May 8, 2026
13 checks passed
@giswqs
giswqs deleted the fix/macos-qgis-managed-python-qgis-plugin-template branch May 8, 2026 22:00
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.

2 participants