9

I'm trying to install Google Cloud SDK in ubuntu, but getting an error:

[root@localhost google-cloud-sdk]# ./install.sh

Welcome to the Google Cloud SDK!

File "/home/marilu/google-cloud-sdk/bin/bootstrapping/install.py", line 182

with open(rc_path) as rc_file:

          ^

SyntaxError: invalid syntax [root@localhost google-cloud-sdk]# 

I have installed Python; this is how it looks

[root@localhost marilu]# ls -l

drwxr-xr-x  5 marilu marilu     4096 Apr  8 11:35 google-cloud-sdk

drwxrwxr-x 19 marilu marilu     4096 Apr 23 09:08 Python-2.7.6

[root@localhost marilu]# 

Can someone help me? Why this error?

5 Answers 5

25

1 Download and install Google Cloud SDK by running the following command in your shell or Terminal:

curl https://dl.google.com/dl/cloudsdk/release/install_google_cloud_sdk.bash | bash

2 Restart your shell or Terminal.

3 Authenticate to Google Cloud Platform by running gcloud auth login.

Did you try that?

Sign up to request clarification or add additional context in comments.

2 Comments

How di I restart the shell on a server. Is there an alternative.
use source ~/.profile && source ~/.bashrc instead of step 2
4
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

sudo apt update

sudo apt-get install google-cloud-sdk

gcloud init

Comments

1

As at the time of writing, the install.sh and install.py require Python 2.7, and I have observed a similar error when the default/system Python is version 3+. You can confirm that by running python --version.

You have several ways to work around this:

  1. Set an environment variable to tell install.sh which python to use, i.e. add the following line to ~/.bashrc:

export CLOUDSDK_PYTHON=/path/to/python2.7

Then source ~/.bashrc and rerun install.py

or 2. Create a python2.7 Virtual Environment, activate it, and then run install.sh

You can find the location of the installed python2.7 executable by running which python2.7.

Comments

0

You can use apt-get to install the Cloud SDK in an Ubuntu/Debían System.

Comments

0

Install google cloud SDK by running the single command:

sudo apt-get install apt-transport-https ca-certificates gnupg && echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && sudo apt-get update && sudo apt-get install google-cloud-sdk && sudo apt-get install google-cloud-sdk-app-engine-java && sudo apt-get install google-cloud-sdk-app-engine-python && gcloud init

Hope your issue will be resolved.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.