Google cloud CLI incompatibility with Python version 3.12 and 3.13

Working on MacOs 15.3.2 I had been accessing a Google Cloud account with xterm. The machine had been configured with Python 3.9.6. After updating Python to v 3.13 the connection no longer worked, and generated an error message:
File “/Users/donaldmarsh/dkgoog/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py”, line 23, in
import imp
ModuleNotFoundError: No module named ‘imp’

Query on Google Cloud forum stated that the imp module was deleted from Python versions 3.12 and thereafter. Python 3.11 is no longer available. Is there a way to fix this?

Perhaps this brief migration guide is helpful?

The google-cloud-sdk package has been deprecated in favor of product-specific packages, and so they haven’t kept up with changes to new python versions. The best solution would be to update your code to use the specific libraries you need from google.

1 Like