Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

"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 3 1,775
3 REPLIES 3

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=&forceOnObject...

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