Open cHiv0rz opened 2 weeks ago
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.
"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?
In addition, I found this meta issue which says the problem with Python 3.12 on gsutil
is fixed here: https://github.com/GoogleCloudPlatform/gsutil/issues/1695
So sorry If i'm missing something, but still don't understand the check
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.
I just applied https://github.com/GoogleCloudPlatform/gsutil/pull/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.
My fault while testing 😅
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)
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
Context
Python 3.12.7
is the default python version inalpine 3:20
, and it breaksgsutil
on its version5.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 withPython 3.12.6
Thanks