10

After installing Google cloud sdk and connecting to desired firebase project i am receiving :

ERROR: (gsutil) "C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe": command not found when running any gsutil command.

My current stup is:

windows 10
Google Cloud SDK 281.0.0
bq 2.0.53
core 2020.02.14
gsutil 4.47
python 3.7

My theory is, that while installed "correctly" python doesnt have access to gsutil commands

mischva11
  • 2,811
  • 3
  • 18
  • 34

5 Answers5

9

I had the same problem and I was able to solve it by setting a new environment variable for CLOUDSDK_PYTHON. On windows 10 you can do this from the command line in 2 ways:

  1. Set an env variable for the current terminal session set CLOUDSDK_PYTHON="C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe"

  2. Set a permanent env variable setx CLOUDSDK_PYTHON="C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe"

The file path will probably be different for everyone, so check first where is python.exe located and use your own path. I hope this helps.

  • 2
    The "setx" command syntax is without the '=' character between the key and the value – Tom Jan 02 '21 at 11:47
1

Run:

set CLOUDSDK_PYTHON=C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe

Note: There should be no quotes around the python path like this "C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe" or it would attempt to run the command with quotes, which we know won't work.

Krishna Chaurasia
  • 8,924
  • 6
  • 22
  • 35
0

To see a list of components that are available and currently installed, run command:

gcloud components list

To update all installed components to the latest available version(282.0) of Cloud SDK, run command:

gcloud components update

You also can reinstall it following this document, while Cloud SDK currently uses Python 2 by default, you can use an existing Python installation if necessary by unchecking the option to 'Install Bundled Python'.

Hao Z
  • 157
  • 6
  • yes thank you but i have gone down that route with nothing wrong i can find – caffieineAnxiety Feb 26 '20 at 14:23
  • Do you try to reinstall it ? – Hao Z Feb 27 '20 at 20:41
  • Re-install using "bundled python" worked, but that's because it is now using its own python installation. Still no idea why updating broke using the existing python installation. – Ehsan Kia Mar 02 '20 at 01:32
  • Still no solution ive found. I have tried reinstall. On "gcloud component update" i noticed some errors that might be something but on trying to replicate i just receive the message all components are up to date. I will uninstall and reinstall + component update to see errors – caffieineAnxiety Mar 02 '20 at 20:32
  • If you uninstall and reinstall Cloud SDK following this [document](https://cloud.google.com/sdk/docs/downloads-interactive#windows), you will get latest version, don't need to update it again. – Hao Z Mar 02 '20 at 20:48
  • I have followed that documentation as well as the version controlled installation. Updating isn't part of the issue, on update or using documentation as you suggest hasn't solved the gsutil error first listed – caffieineAnxiety Mar 05 '20 at 16:14
  • Do you check the PATH in your system "Environment Variables" setting? Is there SDK Path "C:\Users\user\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin "? I installed the Cloud SDK, and then download and install [python 3.7](https://www.python.org/downloads/release/python-376/) as administrator, I checked the PATH in my system, it as this "C:\Users\user\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\user\AppData\Local\Programs\Python\Python37\;C:\Users\user\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin", run "gustil" command in SDK without issue. – Hao Z Mar 06 '20 at 02:10
  • I have been wondering about environmental variables being a cause, i have little to no experience with them but my path is a bit different. Should i change position of Npm and Google SDK? "C:\Users\user\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\user\AppData\Local\Programs\Python\Python37\;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\AppData\Roaming\npm;C:\Users\user\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin" – caffieineAnxiety Mar 09 '20 at 19:17
  • You can try to change position of them, I'm wondering about this "C:\Users\user\AppData\Local\Programs\Python\Python37\;" in your PATH, it is a possibility reason. In my testing environment, "C:\Users\user\AppData\Local\Programs\Python\Python37\Scripts\;" for python 3 environment variables setting. – Hao Z Mar 09 '20 at 19:47
  • I can't reproduce your issue, and I believe this is a local guest OS issue or local operating system issue, it's not Cloud SDK issue. – Hao Z Mar 10 '20 at 00:34
  • Is "C:\Users\user\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\user\AppData\Local\Programs\Python\Python37\" not the same as what you posted? But i'm assuming your right, changing variables had no effect it must be OS – caffieineAnxiety Mar 10 '20 at 15:01
0

As was suggested above reinstalling using bundled python worked for me. I had incorrectly assumed from google's doc i should choose between bundled or current python install not realizing both could run without conflict.

0

Syntax needed to be a little different for me in CMD and/or PowerShell - also I installed Python via the Microsoft Store so the command for me was:

SETX CLOUDSDK_PYTHON "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\python3.9.exe"

you can get the exact path by running the python app from the start menu and then reading the window title:

python 3.9 running as app on windows

Jannis Hell
  • 736
  • 8
  • 17