why am i getting (gsutil): "C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe": command not found
Asked Answered
H

5

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

Hilariohilarious answered 26/2, 2020 at 0:12 Comment(6)
please check whether python installed or not by typing py -3 in cmdBowne
Please explain a little bit more.Amphidiploid
Please share the command you are trying to runKondon
Python is installed. i am trying to set up cors configuration for my react app using gsutil cors set cors.json gs://<your-cloud-storage-bucket> from documentation however by this point i have tried many gsutil commands, gsutil is not a recognized command based off my error message despite being listed when running gcloud -vHilariohilarious
Did you ever find a solution? I'm in the exact same problem.Coca
@EhsanKia you might want to try to edit gsutil.cmd file and add line SET CLOUDSDK_PYTHON=<path to python on your machine>\python.exe right before this line IF "!CLOUDSDK_PYTHON!"==""Longford
N
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.

Nitrification answered 16/4, 2020 at 21:11 Comment(1)
The "setx" command syntax is without the '=' character between the key and the valueAutostability
T
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.

Tsimshian answered 29/4, 2021 at 12:18 Comment(0)
P
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'.

Peccary answered 26/2, 2020 at 1:51 Comment(11)
yes thank you but i have gone down that route with nothing wrong i can findHilariohilarious
Do you try to reinstall it ?Peccary
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.Coca
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 errorsHilariohilarious
If you uninstall and reinstall Cloud SDK following this document, you will get latest version, don't need to update it again.Peccary
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 listedHilariohilarious
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 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.Peccary
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"Hilariohilarious
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.Peccary
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.Peccary
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 OSHilariohilarious
H
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.

Hilariohilarious answered 17/3, 2020 at 21:58 Comment(0)
R
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

Retinue answered 16/6, 2021 at 14:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.