Skip to content

Detect virtual environments by probing the interpreter - #7

Merged
marcoeilers merged 2 commits into
mainfrom
meilers_venv_detection
Jul 9, 2026
Merged

marcoeilers merged 2 commits into
mainfrom
meilers_venv_detection

Conversation

@marcoeilers

Copy link
Copy Markdown
Contributor

isGlobalPythonEnvironment relied on the Python extension's environment metadata, which is unreliable in some setups (the same metadata that misreported interpreter versions), causing a virtual environment to be misclassified as global and triggering a spurious install warning.
Ask the interpreter directly instead: sys.prefix != sys.base_prefix identifies a virtual environment (PEP 405), independent of the extension's metadata.

marcoeilers and others added 2 commits July 9, 2026 16:20
isGlobalPythonEnvironment relied on the Python extension's environment
metadata, which is unreliable in some setups (the same metadata that
misreported interpreter versions), causing a virtual environment to be
misclassified as global and triggering a spurious install warning. Ask the
interpreter directly instead: sys.prefix != sys.base_prefix identifies a
virtual environment (PEP 405), independent of the extension's metadata.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@marcoeilers
marcoeilers merged commit 11e0f66 into main Jul 9, 2026
3 checks passed
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