Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix env version detection on systems with multiple system Pythons #198

Merged
merged 2 commits into from
Mar 24, 2025

Conversation

elprans
Copy link
Contributor

@elprans elprans commented Mar 13, 2025

Most Linux distributions allow installing multiple versions of
Python side-by-side, where binaries are installed as /usr/bin/pythonX.Y
and headers are installed into /usr/include/pythonX.Y.

On such system PET will look for the first patchlevel.h header found in
/usr/include, which would basically be the first Python version in the
directory iteration order.

Fix this by only considering versions that match the MAJOR.MINOR
version found in pyvenv.cfg of the environment (if one exists). This
is valid, because major Python upgrades almost always require the
environment to be re-created.

Most Linux distributions allow installing multiple versions of
Python side-by-side, where binaries are installed as `/usr/bin/pythonX.Y`
and headers are installed into `/usr/include/pythonX.Y`.

On such system PET will look for the first `patchlevel.h` header found in
`/usr/include`, which would basically be the first Python version in the
directory iteration order.

Fix this by only considering versions that match the `MAJOR.MINOR`
version found in `pyvenv.cfg` of the environment (if one exists).  This
is valid, because major Python upgrades almost always require the
environment to be re-created.
@vs-code-engineering vs-code-engineering bot added this to the March 2025 milestone Mar 24, 2025
@DonJayamanne DonJayamanne merged commit 845945b into microsoft:main Mar 24, 2025
20 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.

3 participants