"python: not found" error with version 452.0.0 of Google Cloud CLI

I just upgraded from version 412.0.0 to 452.0.0 of the gcloud CLI, and now no gcloud commands work, they keep failing with the error: /Users/user/google-cloud-sdk/bin/gcloud: line 206: exec: python: not found

I do have python3 installed (python3 --version returns Python 3.11.4), but I don’t have anything with the alias of just python.

I suspect that something changed between 412.0.0 and 452.0.0 with how the CLI references the python executable.

I tried downgrading using gcloud components update --version 412.0.0 but unfortunately keep getting the same error.

Here is the full log from my terminal:

➜  gcloud components update
To help improve the quality of this product, we collect anonymized usage data and anonymized stacktraces when crashes are encountered; additional information is available at
<https://cloud.google.com/sdk/usage-statistics>. This data is handled in accordance with our privacy policy <https://cloud.google.com/terms/cloud-privacy-notice>. You may choose to
opt in this collection now (by choosing 'Y' at the below prompt), or at any time in the future by running the following command:

gcloud config set disable_usage_reporting false

Do you want to opt-in (y/N)? n

Beginning update. This process may take several minutes.

Your current Google Cloud CLI version is: 412.0.0
You will be upgraded to version: 452.0.0

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ These components will be updated. β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Name β”‚ Version β”‚ Size β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ BigQuery Command Line Tool β”‚ 2.0.98 β”‚ 1.6 MiB β”‚
β”‚ BigQuery Command Line Tool (Platform Specific) β”‚ 2.0.98 β”‚ < 1 MiB β”‚
β”‚ Cloud Storage Command Line Tool β”‚ 5.26 β”‚ 11.3 MiB β”‚
β”‚ Cloud Storage Command Line Tool (Platform Specific) β”‚ 5.26 β”‚ < 1 MiB β”‚
β”‚ Google Cloud CLI Core Libraries β”‚ 2023.10.23 β”‚ 22.0 MiB β”‚
β”‚ Google Cloud CLI Core Libraries (Platform Specific) β”‚ 2023.10.23 β”‚ < 1 MiB β”‚
β”‚ anthoscli β”‚ 0.2.42 β”‚ 66.8 MiB β”‚
β”‚ gcloud cli dependencies β”‚ 2023.10.23 β”‚ 11.7 MiB β”‚
β”‚ gke-gcloud-auth-plugin β”‚ 0.5.6 β”‚ 7.4 MiB β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

A lot has changed since your last upgrade. For the latest full release notes,
please visit:
https://cloud.google.com/sdk/release_notes

Do you want to continue (Y/n)? y

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: BigQuery Command Line Tool ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: BigQuery Command Line Tool (Platform Sp... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Cloud Storage Command Line Tool ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Cloud Storage Command Line Tool (Platfo... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Google Cloud CLI Core Libraries ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Google Cloud CLI Core Libraries (Platfo... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: anthoscli ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: gcloud cli dependencies ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: gke-gcloud-auth-plugin ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool (Platform Spec... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Google Cloud CLI Core Libraries ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Google Cloud CLI Core Libraries (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: anthoscli ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gke-gcloud-auth-plugin ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation ═╣
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Performing post processing steps...done.

Update done!

To revert your CLI to the previously installed version, you may run:
$ gcloud components update --version 412.0.0

➜  gcloud components install gke-gcloud-auth-plugin
/Users/user/google-cloud-sdk/bin/gcloud: line 206: exec: python: not found
2 Likes

Hi,

This just happened to me. I had to download the previous version from the archives

https://console.cloud.google.com/storage/browser/cloud-sdk-release;tab=objects?prefix=&forceOnObjectsSortingFiltering=false

I’m also facing the same error

I solved it.

  1. added export CLOUDSDK_PYTHON=/opt/homebrew/bin/python3 above the gcloud initialization lines in my ~/.zshrc
  2. source ~/.zshrc
  3. gcloud components update. this command then ran successfully and I updated gcloud cli to v452.0.1
  4. I went back to ~/.zshrc and commented the line added in step 1.
  5. source ~/.zshrc
  6. gcloud components update. the command ran successfully, indicating that the python not found error was fixed in the new version
1 Like