Error while trying to open Jupyter notebook in Paperspace

Hi
I am using Ubuntu 16.04 machine in Paperspace. I followed the https://github.com/reshamas/fastai_deeplearn_part1/blob/master/tools/paperspace.md for setting up Paperspace. Jupyter notebook was running ok till yesterday.

Today when i try opening Jupyter notebook i’m getting the following error -

Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
Traceback (most recent call last):
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/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/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py”, line 869, in _default_allow_remote
addr = ipaddress.ip_address(self.ip)
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/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/paperspace/anaconda3/envs/fastai/bin/jupyter-notebook”, line 11, in
sys.exit(main())
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/jupyter_core/application.py”, line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/traitlets/config/application.py”, line 657, in launch_instance
app.initialize(argv)
File “”, line 2, in initialize
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/traitlets/config/application.py”, line 87, in catch_config_error
return method(app, *args, **kwargs)
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py”, line 1629, in initialize
self.init_webapp()
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py”, line 1379, in init_webapp
self.jinja_environment_options,
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py”, line 158, in init
default_url, settings_overrides, jinja_env_options)
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py”, line 251, in init_settings
allow_remote_access=jupyter_app.allow_remote_access,
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/traitlets/traitlets.py”, line 556, in get
return self.get(obj, cls)
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/traitlets/traitlets.py”, line 535, in get
value = self._validate(obj, dynamic_default())
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py”, line 872, in _default_allow_remote
for info in socket.getaddrinfo(self.ip, self.port, 0, socket.SOCK_STREAM):
File “/home/paperspace/anaconda3/envs/fastai/lib/python3.6/socket.py”, line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known.

Any help would be appreciated.
Thanks
B

3 Likes

Hi,

I got the same issue after updating the conda env ( $ conda env update ).

My quick fix was:

  1. Go to ~/.jupyter
  2. There should be a config file “jupyter_notebook_config.py”
  3. When it’s not existing, generate it: jupyter notebook --generate-config (in case it’s the correct location)
  4. Add this line e.g. at the end:
    c.NotebookApp.allow_remote_access = False

Info: You might want to change the parameter setting. I’m connecting like this to my paperspace instance: ssh paperspace@123.123.123.123 -L 8888:localhost:8888
So I can access the jupyter notebook like http://localhost:8888/

6 Likes

Hi,

Thanks Erik. I have updated the "jupyter_notebook_config.py”. However i get a Forbidden error when i try connecting to the jupyter notebook.

This is what i get -
jupyter notebook
[I 11:59:31.396 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[W 11:59:32.166 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 11:59:32.416 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.4.0
[I 11:59:32.417 NotebookApp] Serving notebooks from local directory: /home/paperspace/fastai
[I 11:59:32.417 NotebookApp] The Jupyter Notebook is running at:
[I 11:59:32.417 NotebookApp] http://(ps4wq2i1c or 127.0.0.1):8888/?token=88eafd2817a579d15baf69e989ddc1afb2a661b19448f047
[I 11:59:32.417 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:59:32.417 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
    http://(ps4wq2i1c or 127.0.0.1):8888/?token=88eafd2817a579d15baf69e989ddc1afb2a661b19448f047

However when i try to connect http://(ps4wq2i1c or 127.0.0.1):8888/?token=88eafd2817a579d15baf69e989ddc1afb2a661b19448f047
( I have replaced the ((ps4wq2i1c or 127.0.0.1) with my ip.) I get

403 Forbidden error.

I noticed - Blocking request with non-local ‘Host’ 184.105.185.204 (184.105.185.204:8888). If the notebook should be accessible at that name, set NotebookApp.allow_remote_access to disable the check. when i try connecting to jupyter notebook.

Any help would be appreciated.Thanks

An update-

I fixed the error -

I updated “jupyter_notebook_config.py” wiht the lines
27%20PM

And it is working fine.

Thanks for the help

5 Likes

This happened to me after updating my environment. Got it working again thanks to these posts. Here’s a one line fix:

echo 'c.NotebookApp.allow_remote_access = True' >> ~/.jupyter/jupyter_notebook_config.py

Any idea why this suddenly started happening?

8 Likes

I had the same issue as well two days ago. Support did not get back to me in time. Thank you for this help so I don’t get stuck too. Much appreciated.

Ok, now whenever I add my local IP address either way (hostname or public IP) Safari cannot find the server. What am I missing? I am running my machine through the ‘Fastai-MOOC’, if that makes any difference.

The same thing happened to me tonight as well with a new Paperspace machine. I updated from the fastai repo and then updated conda. The single line fix above allowed me to start Jupyter Notebook, but the paperspace machine seems very unstable. It locked up once on me, and now I keep losing the connection to the kernel from my local browser and am not able to reconnect.

I have issues with Paperspace as well. It is very slow. I have started using Colab and it slow too but not as bad as Paperspace.

At this point, I cannot recommend paperspace. I’ve spent more time trying to get the machine to restart, only to have it lock up again, than I spent actually trying to work through the lessons in the first notebook.

Thank you. I experienced the same problems and this is the solution that worked for me.

I followed the instruction in https://github.com/reshamas/fastai_deeplearn_part1/blob/master/tools/paperspace.md until Part IV, step 2.5, but now get stuck. I get the following error: Config option allow_remote_access not recognized by NotebookApp

What should I do? Thanks!

I’ve been stuck on this same problem for weeks too, did you find an answer to it yet?

Hi,

I am using GCP and Colab. I no longer use Paperspace.

Thanks

I suggest to follow these steps (as these worked for me):

  1. Execute following command in directory /home/paperspace/fastai
    jupyter notebook --generate-config

  2. Then open the file (/home/paperspace/.jupyter/jupyter_notebook_config.py) using vim:
    vim jupyter_notebook_config.py

  3. Go to the end of this file and these lines (as shared by @Bhuvana_ka):
    27%20PM

  4. If you do not know vim commands then go to this page for help:
    https://www.radford.edu/~mhtay/CPSC120/VIM_Editor_Commands.htm

  5. After saving and closing ‘jupyter_notebook_config.py’ , go to /fastai directory and run this:
    jupyter notebook

It should work now!

2 Likes

Thus worked for me. Thank you.

Thank you, it worked for me.