0

I have just replaced my old Mac with M1 Mac and something went wrong with Python after the data transfer.

I am trying to run Big Query queries on Jupyter Notebook. After downloading the the google-cloud-sdk folder, I am running the command gcloud init to start the setup and login using the credentials. Something that used to work smoothly before.

Now, every time I run the command, this shows up in my terminal:

/Desktop/google-cloud-sdk/bin/gcloud: line 181: exec: python2: not found

I am using Monterey v12.5.1, z shell. Any ideas how do I solve this?

viiivi
  • 11
  • 3
  • 2
    I don't think they install Python 2 any more. Just Python 3. You should be able to get Python 2 through HomeBrew. Are you using that? – Tim Roberts Aug 23 '22 at 16:43
  • I do not use HomeBrew and I also do not understand why would I need Python 2 in this case. I have Python 3.8.2 installed (shows after running python -V in terminal). – viiivi Aug 23 '22 at 16:49
  • The `gcloud` command you have needs Python 2. You need to upgrade to version 274. https://stackoverflow.com/questions/38113281/is-there-any-way-to-use-gcloud-with-python3 – Tim Roberts Aug 23 '22 at 18:11

1 Answers1

0

I encountered the same error after upgrading my Mac from macOS 10.15 (Catalina) to macOS 13 (Ventura). Adding this to your environment should solve the problem:

export CLOUDSDK_PYTHON=/usr/bin/python3

I also reinstalled gcloud using the Mac instructions here: https://cloud.google.com/sdk/docs/install-sdk#mac. But I'm not sure this was necessary, so I suggest you just try setting CLOUDSDK_PYTHON first.

bosconi
  • 190
  • 1
  • 5