8

Google Cloud SDK installation process is failing on my machine(MAC) and giving me following stack trace.

Traceback (most recent call last):
  File "/Users/ttn/Desktop/google-cloud-sdk/bin/bootstrapping/install.py", line 218, in <module>
    main()
  File "/Users/ttn/Desktop/google-cloud-sdk/bin/bootstrapping/install.py", line 203, in main
    sdk_root=bootstrapping.SDK_ROOT,
  File "/Users/ttn/Desktop/google-cloud-sdk/lib/googlecloudsdk/core/platforms_install.py", line 452, in UpdateRC
    completion_update, path_update, rc_path, sdk_root, host_os).Update()
  File "/Users/ttn/Desktop/google-cloud-sdk/lib/googlecloudsdk/core/platforms_install.py", line 214, in Update
    self.path, rc_contents, source_line=self._GetSourceLine())
  File "/Users/ttn/Desktop/google-cloud-sdk/lib/googlecloudsdk/core/platforms_install.py", line 167, in _GetRcContents
    filtered_contents=filtered_contents, line=line)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 197: ordinal not in range(128)

Here are few more details:

System's default python version

python -V
Python 3.6.1 :: Anaconda custom (x86_64)

Python version for Cloud SDK.

echo $CLOUDSDK_PYTHON
/usr/bin/python2.7

Checking gcloud command

gcloud
-bash: gcloud: command not found

Note: This question might seem as duplicate, but i tried few solution available on portal but nothing worked for me.

Gaurav Gupta
  • 4,586
  • 4
  • 39
  • 72

1 Answers1

2

There is an open pull request to address this issue linked below that fixes the issue. The issue was that one of the files contain non-ASCII characters which causes the the Google Cloud SDK installer to fail. The open() function in Python 2.7 doesn't allow for a specified encoding.

Fix:
All references with open() should be replaced with io.open(..., encoding='utf-8'). Once again check the pull request to see those changes.

Resources:
- https://github.com/google-cloud-sdk/google-cloud-sdk/pull/2/files

dkroy
  • 2,020
  • 2
  • 21
  • 39
  • I had the same issue. After replacing the `./google-cloud-sdk/lib/googlecloudsdk/core/platforms_install.py` file with the PR changes you referred it worked like a charm! – LeBaptiste May 31 '18 at 23:51