Error: Unauthorized on my own Google Cloud notebook

Viewed 1890

I just built a Compute Engine app with a Ubuntu 16.04 VM, launched it in Chrome, installed python3, the ipython kernel, and some libraries, so that I could run Jupyter notebooks. Here are the commands:

sudo apt-get update
sudo apt-get install python3-setuptools python3-dev libzmq-dev
sudo easy_install3 pip
sudo pip3 install ipython pyzmq jinja2 tornado jsonschema
sudo pip3 install jupyter
sudo ipython kernel install
sudo pip3 install numpy scipy scikit-learn pandas matplotlib

The last command gave this message, twice:

The directory '/home/allennugent/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Hoping this wouldn't be a show-stopper, I went on to set up a firewall rule with Source IP ranges = '0.0.0.0/0' and Protocols and ports = 'tcp:8888'. Then I launched jupyter:

jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser &

This created hyperlink to the notebook. When I click on the link (in the Serial Console window), a browser page opens with

Error: Unauthorized You are currently logged in as [my gmail address] which does not have access to Cloud Shell 3118611.

According to the Cloud Platform dashboard I was logged in under the same account name when I set up the Compute Engine, so I don't know what is going wrong with the authorization.

Am I missing something?

1 Answers

I had this problem too and for me it was solved by typing the VM's external IP and port in the address bar without http or https:// preceding it.

e.g. xx.xxx.xxx.xxx:8888

Then for my notebook I was required to copy the access token (the token=[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] part, just the characters in square brackets here) from the terminal into the password prompt when jupyter shows in the browser.

Related