How to set up env using Google Cloud?


Just checking, does your instance also has the jupyter tag?


Yes… it has…

Network tags

http-server, https-server, jupyter


I’m not sure what could be cause that it isn’t working. (By the way, I’d disable http-server and https-server, unless you’re using those).

Suggestions for troubleshooting:
Use the following command (from your local machine) to see which instances are running with which external IP: gcloud compute instances list

I’d suggest rebooting the instance, and make sure you are using the correct external IP, and make sure that you started jupyter with jupyter notebook --ip= --port=8888. Note that the external IP can change after stopping an instance, unless you use a static IP.

You could also try to do the following:

  • start another terminal window (with tmux) and see if you can access jupyter
  • start another instance (a really tiny cheap one) and see if you can access the jupyter instance with the internal IP address

I hope this helps!


Thanks @sebastian for the troubleshooting steps, it was an IP problem, My network was changing the IP through which traffic was going out. I checked the IP on and used in the jupyter fireawall tag and it worked.Just mentioning here if any one faces the similar problem.

However, once the notebook is up and running on the local browser and i try to create new notebook i am getting the error- A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.

Not sure if this is also the problem with my local network :frowning:



Thanks for posting the detailed guides.

I tried creating an instance and got this error:

(gcloud.beta.compute.instances.create) Could not fetch resource:

  • Quota ‘NVIDIA_K80_GPUS’ exceeded. Limit: 0.0

It seems that there’s a need for a special quota request. I’ve already mailed their support, but I was just curious to know if anybody else also faced this, since there were no mentions on this discussion.



Maybe new users don’t have a GPU quotum by default. I have requested quota increases in the past though, and usually they respond very quickly. (Within the hour or so).


Securing the instance with the firewall only works if your IP is static. So you could consider disabling the firewall, but be aware this is a security risk, so make secure Jupyter is protected with a password.


By default new users are not given the GPU instances. You will have to request the limit increase.

Also note that to request a limit increase you will have to upgrade to the paid account.


thanks @sebastian for you awesome steps and guidance throughout! It is an issue with my office network. It works fine on my home internet.

As long as i know the IP of my office network is also static. Anyways, i will work this out… cheers!


Oooh, maybe your office network has certain ports blocked. Changing the from 8888 into something else might do the trick.

Good luck, glad I could be of any help!

(anthony vazha) #52

@sebastian Thank you for the instructions but I am having problems starting on Step:6, getting error on the last command. Also getting this when I do step7:] [nb_conda_kernels] enabled, 2 kernels found Traceback (most recent call last): File "/home/anthonyvazha/anaconda2/bin/jupyter-notebook", line 6, in <module> sys.exit(notebook.notebookapp.main()) File "/home/anthonyvazha/anaconda2/lib/python2.7/site-packages/jupyter_core/ ", line 267, in launch_instance return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs) File "/home/anthonyvazha/anaconda2/lib/python2.7/site-packages/traitlets/config/applicatio", line 657, in launch_instance app.initialize(argv) File "<decorator-gen-7>", line 2, in initialize File "/home/anthonyvazha/anaconda2/lib/python2.7/site-packages/traitlets/config/applicatio", line 87, in catch_config_error return method(app, *args, **kwargs) File "/home/anthonyvazha/anaconda2/lib/python2.7/site-packages/notebook/", l ine 1296, in initialize self.init_webapp() File "/home/anthonyvazha/anaconda2/lib/python2.7/site-packages/notebook/", l ine 1120, in init_webapp self.http_server.listen(port, self.ip) File "/home/anthonyvazha/anaconda2/lib/python2.7/site-packages/tornado/", line 142, in listen sockets = bind_sockets(port, address=address) File "/home/anthonyvazha/anaconda2/lib/python2.7/site-packages/tornado/", line 1 97, in bind_sockets sock.bind(sockaddr) File "/home/anthonyvazha/anaconda2/lib/python2.7/", line 228, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 99] Cannot assign requested address
any help reagarding this will help.

(taotaopan) #53

I have the same question here. I have checked the documents of GCP. It does mention that by default free trial is not included GPU usage. It seems we have to promote the free trial to real project usage. Does it calculate the price from the free trial money?

(FriendlyStranger) #55

Has anyone figured out easy way to change the source IP for firewall? My IP keeps changing randomly and I am not sure how to change this in firewall configuration. Any help would be appreciated.

(FriendlyStranger) #56

I am using your method for GCP setup. I get permission error message when I try to install kaggle-cli tools in my instance. Any help would be appreciated.


Please don’t take this the wrong way, but have you read

I’d like to help, but please try to solve a problem by yourself first, and give enough information on what you have tried, what the possible cause might be, et cetera, before asking for help. And do a search first, here on the forums, but also a Google search, to see if you can find an answer to your question yourself.

(FriendlyStranger) #58

Hi Sebastian,
I really appreciate your help and read the document you posted again. I have tried Google search to solve my problem but couldn’t get any pip to install kaggle-cli.

So I have pip install in > /home/username/anaconda2/bin/pip.

I am trying to install kaggle-tools via pip which fails with following error message.

IOError: [Errno 13] Permission denied: ‘/home/pushkar291191/anaconda2/lib/python2.7/site-packages/prettytable.pyc’

I don’t think using sudo is an option here as the whole point of using conda is to not have the permissions issues. And using sudo gives me the error that pip is not installed.

I have followed the steps and scripts you have provided in your guide. Any help would be appreciated in troubleshooting this issue.

(FriendlyStranger) #59

Creating a new instance of VM solved the issue for me.

Also when installing kaggle-cli I had to call it in following manner

pip install kaggle-cli --user

(Chan Sooi Loong) #60

Seemed that you don’t have permission to the folder.
Try sudo chown -R $USER /home/pushkar291191/anaconda2

(Chamoda Pandithage) #61

I wrote some formation scripts similar to aws scripts.

alias gcloud-start="gcloud compute instances start ubuntu"

alias gcloud-ip='GCLOUD_IP=$(gcloud --format="value(networkInterfaces[0].accessConfigs[0].natIP)" compute instances list)'

alias gcloud-notebook="gcloud-ip && ssh -N -f -L localhost:8888:localhost:8888 -i ~/.ssh/gcloud.pem chamoda@$GCLOUD_IP && ssh -i ~/.ssh/gcloud.pem chamoda@$GCLOUD_IP 'export PATH='/home/chamoda/anaconda2/bin:$PATH' && jupyter notebook'"

alias gcloud-connect="gcloud-start && gcloud compute ssh chamoda@ubuntu"

alias gcloud-stop="gcloud compute instances stop ubuntu"

(Nikhil) #62

Thanks for your awesome script. I have added 3 lines after this script.

source ~/.bashrc
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pem
jupyter notebook --certfile=mycert.pem --keyfile mykey.key --port=7000
#7000 is my port as per