I'm trying to create a data science environment in Google Cloud Platform, with Python, Miniconda and Jupyter. But I'm encountering an error when I try to access jupyter with an external IP
I followed these steps:
1 - I've accessed the Resource Management page (https://console.cloud.google.com/cloud-resource-manager). Create a new project (test_01)
2 - I opened the Dashboard (https://console.cloud.google.com/home/dashboard). I selected the project I just created (test_01)
3 - In the top left menu - Select "Compute Engine" and click on "VM instances. Click on the "Create" button
4 - I filled in: Name the instance (the-who), Select the region (in my case - northamerica-northeast1-a), Select the memory, storage and CPU, Select the boot disk, Remote access SSH, Make sure you can access the VM from the internet by allowing Http and Https traffic and Click on "Create"
5 - I opened Google's Cloud Shell. I pressed the button >_
6 - With the Ubuntu terminal open, I typed in to create a password for root: sudo passwd
7 - Enter the command to enter SSH: gcloud compute ssh the-who
8 - There is always a question about the zone: Did you mean zone [us-east1-c] for instance: [the-who] (Y/n)? - Since mine zone is different (northamerica-northeast1-a) I press n
9 - I begin to install packages (bzip2 git libxml2-dev): "sudo apt-get update" and "sudo apt-get install bzip2 git libxml2-dev"
10 - Now install the miniconda, scikit-learn, pandas, jupyter and ipython: "wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh", "bash Miniconda3-latest-Linux-x86_64.sh", "rm Miniconda3-latest-Linux-x86_64.sh", "source .bashrc" and "conda install scikit-learn pandas jupyter ipython"
11 - I check installation: "python --version" and "which python"
12 - Now I want to set up my VM to allow Web access to my Jupyter notebooks. I returned to the instance panel and in the top left menu I selected "VPC Network > Firewall rules". I clicked on the "CREATE FIREWALL RULE" link and filled in with the following values
13 - Name: jupyter-rule * Source IP ranges: 0.0.0.0/0 * Specified protocols and ports: tcp:8888 * Target tags: the-who * and leave all the other variables to their default values. As a result, this firewall rule allows all incoming traffic (of all IPs) to reach port 8888.
14 - I returned to the VM page (upper left menu> Compute Engine> VM instances) and clicked on the VM name. I wrote down the VM's external IP address
15 - Back to the terminal I configure the jupyter. I type "jupyter notebook --generate-config" to generate the configuration file and to generate a password "jupyter notebook password"
16 - Now edit the jupyter configuration file: vim .jupyter/jupyter_notebook_config.py
17 - In the first line write and then save and close the file: c.NotebookApp.ip = '*'
18 - The above command will allow the notebook to be available for all IP addresses on your VM. And then I started the Jupyter Notebook with the command line: jupyter-notebook --no-browser --port=8888
But I found this error message:
(base) reichaves@the-who:~$ jupyter-notebook --no-browser --port=8888
[I 11:51:06.234 NotebookApp] Writing notebook server cookie secret to /run/user/1001/jupyter/notebook_cookie_secret
Traceback (most recent call last):
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/traitlets/traitlets.py", line 528, in get
value = obj._trait_values[self.name]
KeyError: 'allow_remote_access'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 864, in _default_allow_remote
addr = ipaddress.ip_address(self.ip)
File "/home/reichaves/miniconda3/lib/python3.7/ipaddress.py", line 54, in ip_address
address)
ValueError: '' does not appear to be an IPv4 or IPv6 address
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/reichaves/miniconda3/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "</home/reichaves/miniconda3/lib/python3.7/site-packages/decorator.py:decorator-gen-7>", line 2, in initialize
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1628, in initialize
self.init_webapp()
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1378, in init_webapp
self.jinja_environment_options,
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 159, in __init__
default_url, settings_overrides, jinja_env_options)
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 252, in init_settings
allow_remote_access=jupyter_app.allow_remote_access,
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/traitlets/traitlets.py", line 556, in __get__
return self.get(obj, cls)
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/traitlets/traitlets.py", line 535, in get
value = self._validate(obj, dynamic_default())
File "/home/reichaves/miniconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 867, in _default_allow_remote
for info in socket.getaddrinfo(self.ip, self.port, 0, socket.SOCK_STREAM):
File "/home/reichaves/miniconda3/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
Please, does anyone know if any setup details were missing?