4

I am fairly new to programming. I have started app development on google app engine. I am trying to get the Google Cloud SDK to work with Cygwin 32 on Windows. I first ran the curl command to download the Google SDK files. Then I ran the install.py script and installed the SDK, however when calling gcloud in cygwin I receive this message:

Ammar Husain@Ammar-Computer:~
$ gcloud
/cygdrive/c/Users/Ammar Husain/google-cloud-sdk/bin/gcloud: line 102: C:\Python27: command not found

I have looked everywhere for a solution and have not been able to find one. I examined the gcloud file in the program files and it seems that there may be a problem with the Python Root Directory but I'm not sure. It may also be my Environment Variables.

Someone help?

Ammar Husain
  • 43
  • 1
  • 3

3 Answers3

4

I was having the same problem with Python not understanding the cygwin path. Instead of changing the gcloud script I created a C:/cygdrive folder. Then, I opened a windows command prompt and cded to the new folder. There, I ran mklink /D c C:\.

This created a link to the C: drive in such a way that Python understands /cygdrive/c/….

double-beep
  • 5,031
  • 17
  • 33
  • 41
  • 2
    This worked for me as well, thanks! Just a little note to others: the `mklink` command requires an elevated command prompt (which can be started via the _Run as Administrator_ option from the context menu) – typeracer Oct 11 '19 at 01:59
  • This was my issue, although it is not exactly what the OP had as a problem. But I had this error: can't open file '/cygdrive/ ... /google-cloud-sdk/lib/gcloud.py': [Errno 2] No such file or directory – Axonn Aug 12 '20 at 07:42
2

First: Cygwin 32? Do you have a 32bit machine? Otherwise the 64bit Version will be the better choice!

Please have a look here, if you DIDN'T install python via cygwin: Using python on windows

If you DID install it via cygwin: Set up python on windows

You might also have a look here: Set the pythonpath on cygwin

In all cases you have to add the python-directory to the PATH-Variable in Windows AND cygwin:

set PYTHONPATH=%PYTHONPATH%;C:\Path-to-python
echo "PATH=\$PATH:/cygdrive/c/Path-to-python" >> .bash_profile
Community
  • 1
  • 1
Horst
  • 334
  • 1
  • 12
  • 1
    NOTE: using Cygwin64 will give you: ERROR: Cygwin 64 bit is not supported by the Google Cloud SDK. Please use a 32 bit version of Cygwin. – HidekiAI Jan 25 '16 at 16:21
  • 1
    64bit version runs just fine, @HidekiAI It helped me a lot to use folders without spaces or braces – Dr. Max Völkel Dec 13 '16 at 13:02
  • This did not help. I'm still getting "C:\Python27\python.exe: can't open file '/cygdrive/c/Users...." error when running gcloud in cygwin. I did a hack in gcloud tool. Added following line inside gcloud script: CLOUDSDK_ROOT_DIR="C:\\Users\\$USER\\AppData\\Local\\Google\\Cloud SDK\\google-cloud-sdk". Hacky but was the only solution i cloud find for now. – rubenhak Jul 25 '19 at 18:19
0

After installing python 3.8 in my cygwin (with cygwin setup-x86_64.exe), I've used the versioned archive for Linux from

https://cloud.google.com/sdk/docs/downloads-versioned-archives

Then, I installed it in my cygwin home directory with this steps:

$ tar -xvf google-cloud-sdk-xxx.x.x-linux-x86_64.tar.gz
$ ./google-cloud-sdk/install.sh
$ source ~/.bashrc // 

It worked for me

Stefano Giraldi
  • 1,211
  • 2
  • 13
  • 22