Fix macOS QGIS dependency installer - #11
Merged
Merged
Conversation
There was a problem hiding this comment.
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
.appbundle and exclude them from interpreter selection. - Update
create_venv()to preferuv venv, using--managed-pythonwhen 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 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" |
| python_exe = _find_python_executable() | ||
| subprocess_error = "" | ||
| if python_exe is None: | ||
| raise RuntimeError(python_lookup_error) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
metadata.txt.Root Cause
Official macOS QGIS installer builds can expose Python wrappers inside
QGIS*.app/Contents/MacOSthat 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 asencodings.Validation
python -m py_compileon the changed dependency manager