'gcloud not recognized as an internal or external command on Windows

I am installing Google App Engine under Windows (not using Cygwin). After running the bat script, I closed and reopened the cmd.exe and entered inside the google-cloud-sdk directory. When I ran the command gcloud auth login, I'm getting the error:

'gcloud' is not recognized as an internal or external command,
operable program or batch file.


Solution 1:[1]

Me too had the same issue that

'gcloud is not recognized as an internal or external command' .

For windows 7 user goto: MyComputer->Right Click - Properties -> Advanced System Settings - advanced - Environment Variables.

First have to set path extension.

This can be done by:

Under System variables in Environment variables choose PATHEXT->Edit -> Add ' ;.PY'.....PY for Python Support

Second change the environment variable:

Under System variables in Environment variables choose PATH->Edit-> ADD "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin " and click OK.

Now restart the command shell and check with the following command :

'gcloud -h'

Sure it will work.

Solution 2:[2]

If it is still not working you should also add path for Google Cloud SDK Staging in your system path,

C:\Program Files\Google\Cloud SDK\google-cloud-sdk.staging\bin

So you require both of the following in your system path property

  • C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin
  • C:\Program Files\Google\Cloud SDK\google-cloud-sdk.staging\bin

Solution 3:[3]

Like Domenic called out, I was missing the /bin folder because of the corporate proxy.

I followed these steps:

set http_proxy=<<your_http_proxy>>
set https_proxy=<<your_https_proxy>>
cd "c:\Program Files\Google\Cloud SDK"
c:\Python27\python.exe google-cloud-sdk\install_google_cloud_sdk.py --install-directory .

The installation completed successfully but it wasn't added to the PATH environment variable, so I had to manually add "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin\" to it.

Solution 4:[4]

For me the system path variable C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin was already set. Had to add C:\Program Files\Google\Cloud SDK\google-cloud-sdk.staging\bin as well to get it up working smoothly. Hope this resolves the issue

Solution 5:[5]

just below path in environment variables there is PATHEXT, have to add .PY to it, as the gcloud is gcloud.py,

also have to add

C:\Program Files\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\gcloud;

C:\Program Files\Google\Cloud SDK\google-cloud-sdk.staging\lib\googlecloudsdk\gcloud

to the environmental variable path.

Solution 6:[6]

If you don't even have the /bin folder, chances are you are on a corporate network that uses a proxy server to get to the Internet and the SDK did not get installed properly. This gets further compounded if you use a PAC to configure your proxy settings. The SDK installer doesn't give you any indication of a failure when installing. You should have a file called install_google_cloud_sdk.py though. On the command line, run python install_google_cloud_sdk.py --install-directory [install dir].

After a few moments you'll see detailed errors that may help you determine your next steps or it could just hang indefinitely. Below is an example of what I originally experienced.

Traceback (most recent call last):
  File "install_google_cloud_sdk.py", line 90, in <module>
    main()
  File "install_google_cloud_sdk.py", line 74, in main
    archive_path = DownloadArchive(t, url)
  File "install_google_cloud_sdk.py", line 54, in DownloadArchive
    req = urllib2.urlopen(url)
  File "C:\python27_x64\lib\urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\python27_x64\lib\urllib2.py", line 404, in open
    response = self._open(req, data)
  File "C:\python27_x64\lib\urllib2.py", line 422, in _open
    '_open', req)
  File "C:\python27_x64\lib\urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "C:\python27_x64\lib\urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "C:\python27_x64\lib\urllib2.py", line 1181, in do_open
    h.request(req.get_method(), req.get_selector(), req.data, headers)

I had to change my Internet proxy from the PAC file to a named server and port. Apparently the python interpreter does not handle PAC configurations very well.

Solution 7:[7]

I am having the same Issue but fortunately I've got it resolved :)

First thing gcloud is actually gcloud.py so you have to fix this by adding .py to PATHTEXT environment variable, second try to locate gcloud.py by searching inside the C:\Program Files\Google\Cloud SDK\google-cloud-sdk mine happened to be in this path C:\Program Files\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\gcloud copy it and add it to PATH environment variable

As steps:

  1. Go to control panel and type environment into search and click Edit the system environment variables
  2. Click on environment variables button
  3. Edit PATHTEXT add: ;.py
  4. Edit PATH add the path for gcould, mine be like: ;C:\Program Files\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\gcloud

hopefully everything will workout for you

Solution 8:[8]

In my case, it's because my laptop connect to internet using corporate proxy when install google cloud. I assume the proxy block connection to google cloud installation file.

So, I try to re-install with my own internet connection and the problem solved

Solution 9:[9]

For me I had to add the following path to my Environment system path:

C:\Users\<my windowns username>\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin

Solution 10:[10]

I too got the same error. I tried above two answers. But did not help then, I deleted python from control panel and deleted the Google sdk folder from ProgramFiles. Reinstalled GoogleCloudSDK. Now everything is fine.

And go to C:\Program Files\Google\Cloud SDK\google-cloud-sdk and click on install.bat and complete. And in cmd-------> gcloud config set project projectid

Solution 11:[11]

If you have installed Google App Engine, remove it and install GoogleCloudSDK and Google App Engine.

Solution 12:[12]

Just try to run as administrator the ..\Cloud SDK\google-cloud-sdk\install.bat and follow the instructions. At the end it will automatically add the needed dependecies to the PATH variable.

Solution 13:[13]

None of the above helped on Windows 8.1 64 bit. Because the SDK is 32 bit and it installs 64 bit Python.

I solved this by uninstalling the SDK and Python, removing folders. I downloaded python 32 bit, installed it and then the SDK and it worked.

Solution 14:[14]

In my case, I had a folder gClould and gCloud.staging after updating. I could not remove the gCloud folder so I closed all my apps first, then renamed the folder, and changed the gCloud.staging to gCloud. Everything worked after that. For some, this could be your problem, especially it was working before.

Good luck!

Solution 15:[15]

If you have to deploy your projects then follow Google's quick start guide https://cloud.google.com/functions/docs/quickstart

from installing the Gcloud SDK to deploying your project.

Finally, if You are using window's 10 then

C:\Users{system name}\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin

use this as an environment path to use Gcloud in cmd.