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

gsutil 5.31 doesn't work with Python 3.12.7 in alpine #1808

Closed
cHiv0rz opened this issue Oct 17, 2024 · 11 comments
Closed

gsutil 5.31 doesn't work with Python 3.12.7 in alpine #1808

cHiv0rz opened this issue Oct 17, 2024 · 11 comments

Comments

@cHiv0rz
Copy link

cHiv0rz commented Oct 17, 2024

Context

Python 3.12.7 is the default python version in alpine 3:20, and it breaks gsutil on its version 5.31. Looking into the code, it seems 3 weeks ago this check was added.

Why is the incompatibility issue on this version? Because gsutil 5.30 works fine with Python 3.12.6

Thanks

@NachE
Copy link

NachE commented Oct 17, 2024

It looks like gsutil is incompatible with Python 3.12 due to the removal of the imp module, as described here: https://issuetracker.google.com/issues/303737178. Python 3.12.6 shouldn't work either, since the imp module was removed starting with Python 3.12.0.

@cHiv0rz
Copy link
Author

cHiv0rz commented Oct 18, 2024

"Shouldn't" but it works, because I actually using it in version 5.30 with Python 3.12.6, at least for "normal" usage like list files, copy, move, etc. What specific function is failing? maybe we can throw the error only on that part, and not break the whole utility?

@cHiv0rz
Copy link
Author

cHiv0rz commented Oct 18, 2024

In addition, I found this meta issue which says the problem with Python 3.12 on gsutil is fixed here: #1695

So sorry If i'm missing something, but still don't understand the check

@ElijahLynn
Copy link

ElijahLynn commented Oct 18, 2024

Just ran gcloud components update at the request of the prompt today and now getting:

Error: gsutil requires Python version 2.7 or 3.5-3.11, but a different version is installed.
You are currently running Python 3.12
Follow the steps below to resolve this issue:
	1. Switch to Python 3.5-3.11 using your Python version manager or install an appropriate version.
	2. If you are unsure how to manage Python versions, visit [https://cloud.google.com/storage/docs/gsutil_install#specifications] for detailed instructions.
	
python3 --version
Python 3.12.5

Debugging now. But just wanted to pass on feedback this is frustrating, as I'm doing a time sensitive task and now gsutil doesn't work for my task.

@ElijahLynn
Copy link

ElijahLynn commented Oct 18, 2024

I just applied #1809 but with this addition https://github.com/GoogleCloudPlatform/gsutil/pull/1809/files#r1806891229 to /opt/homebrew/Caskroom/google-cloud-sdk/436.0.0/google-cloud-sdk/platform/gsutil/gsutil.py and I am up and running again.

@NachE
Copy link

NachE commented Oct 18, 2024

My fault while testing 😅

@joshheinrichs-shopify
Copy link

the gsutil wrapper that google-cloud-sdk packages thinks that 3.12 works, so if python or python3 points to 3.12, it'll use 3.12 and then explode. it won't go digging for python3.11 even if it's installed. it seems to treat 3.12 as a last resort, but doesn't consider python3 / python may be pointing at 3.12:

CLOUDSDK_PYTHON=$(order_python python3 python python3.11 python3.10 python3.9 python3.8 python3.12)

@bennett39
Copy link

For anyone who reached this page looking for a quick fix, reverting the version of my gcloud components got me running again on python 3.12:

gcloud components update --version 494.0.0

@diwu-sf
Copy link

diwu-sf commented Nov 27, 2024

export CLOUDSDK_PYTHON=python3.11 seems like a better workaround until they officially fix it to support 3.12, and can still run on latest gcloud components

@dmitshur
Copy link

dmitshur commented Dec 12, 2024

The comment at #1776 (comment) (CC @sameer-google) suggests that gsutil version 5.32 and above supports Python 3.12.

@cHiv0rz
Copy link
Author

cHiv0rz commented Dec 12, 2024

Thanks! I confirm that gsutil 5.32 is working fine with Python 3.12

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

No branches or pull requests

7 participants