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

Specify python3 instead of python3.7 for pre-commit #9293

Merged
merged 1 commit into from
Jan 7, 2022

Conversation

pmossman
Copy link
Contributor

@pmossman pmossman commented Jan 4, 2022

On an M1 mac with python3.7 and python3.10 installed, I see the following error any time I attempt to commit:

[INFO] Installing environment for https://github.com/johann-petrak/licenseheaders.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/Users/parker/.pyenv/versions/3.10.0/bin/python3.10', '-mvirtualenv', '/Users/parker/.cache/pre-commit/repoyd65z1bj/py_env-python3.7', '-p', 'python3.7')
return code: 1
expected return code: 0
stdout:
    RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.7'

stderr: (none)
Check the log at /Users/parker/.cache/pre-commit/pre-commit.log

Changing the default language version from python3.7 to python3 fixes this issue for me.

@sergei-solonitcyn, I'm not sure what the wider implications of such a change would be but if it seems safe to you, it'd help out M1 users who are running into this issue. (@edgao confirmed he has the same issue on his M1)

Copy link
Contributor

@sergei-solonitcyn sergei-solonitcyn left a comment

Choose a reason for hiding this comment

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

I believe, installing python3.7 and using it in your development environment should fix it. And that would help to avoid making unsupported changes.

But from my perspective this change is not expected to break anything, so I don't mind.

@pmossman
Copy link
Contributor Author

pmossman commented Jan 6, 2022

I have python3.7 installed and tried using it in my development environment, but the issue remained. Here's what it looks like:

❯ git commit -m "try reverting back to 3.7"
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /Users/parker/.cache/pre-commit/patch1641509857-30749.
[INFO] Installing environment for https://github.com/johann-petrak/licenseheaders.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Restored changes from /Users/parker/.cache/pre-commit/patch1641509857-30749.
An unexpected error has occurred: CalledProcessError: command: ('/Users/parker/.pyenv/versions/3.10.0/bin/python3.10', '-mvirtualenv', '/Users/parker/.cache/pre-commit/repoyd65z1bj/py_env-python3.7', '-p', 'python3.7')
return code: 1
expected return code: 0
stdout:
    RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.7'

stderr: (none)
Check the log at /Users/parker/.cache/pre-commit/pre-commit.log


❯ pyenv version
3.7.9 (set by /Users/parker/code/airbyte/.python-version)

So I think if you don't mind, Sergei, I'll merge this in to avoid spending more time digging/debugging. If I run into other python version-related issues with this M1, I may revisit this in the future to see if I can determine a root cause.

@pmossman pmossman force-pushed the parker/python-pre-commit-issue branch from 8ac70ad to 0432cdc Compare January 6, 2022 23:03
@pmossman pmossman temporarily deployed to more-secrets January 6, 2022 23:04 Inactive
@pmossman pmossman force-pushed the parker/python-pre-commit-issue branch from 0432cdc to f823c17 Compare January 7, 2022 21:48
@pmossman pmossman temporarily deployed to more-secrets January 7, 2022 21:49 Inactive
@pmossman pmossman merged commit c071d73 into master Jan 7, 2022
@pmossman pmossman deleted the parker/python-pre-commit-issue branch January 7, 2022 22:16
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.

None yet

2 participants