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

Validate Python version when initializing xbuildenv #62

Merged
merged 3 commits into from
Nov 25, 2024

Conversation

ryanking13
Copy link
Member

This adds a check when initializing xbuildenv (== init_environment) to make sure the local Python version used to install the xbuildenv was not changed.

This prevents the following scenario:

  1. One has a local Python version (3.11.3) and installs Pyodide xbuildenv (0.25.1).
  2. Then, one changes the local Python version to (3.12.1) using pyenv.
  3. Pyodide xbuildenv 0.25.1 is no longer compatible to the local Python version, so it should fail.

Related issue: #44

Copy link
Member

@hoodmane hoodmane left a comment

Choose a reason for hiding this comment

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

Thanks!

raise ValueError(
f"local Python version ({version_local}) does not match the Python version ({version_on_install}) "
"used to create the Pyodide cross-build environment. "
"Please reinstall the xbuildenv, by running `pyodide xbuildenv uninstall` and then `pyodide xbuildenv install`"
Copy link
Member

Choose a reason for hiding this comment

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

Or maybe switch back to the original Python version?

@ryanking13 ryanking13 merged commit ea85b85 into pyodide:main Nov 25, 2024
4 checks passed
@ryanking13 ryanking13 deleted the check-python-version branch November 25, 2024 10:30
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