Cannot run jupyter notebook after setup

Hello all,

I am trying to get started in paperspace according to the instructions by reshamas, though from the start I have been running into problems. I ran git pull, everything is up to date. Now running conda env update gave some error messages like:

jupyter-console 5.2.0 has requirement prompt-toolkit<2.0.0,>=1.0.0, but you'll have prompt-toolkit 2.0.5 which is incompatible.

It also gave these messages for spacy, and some other things that I dont remember. I just pip installed all of them seperately to try to get around it. Though after pip install jupyter-console, ipython starts to complain:

ipython 7.0.1 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.15 which is incompatible.

Now when I pip install ipython, jupyter-console starts to compmlain again and so on.

This results (i think) in me not being able to start the jupyter notebook:

~/fastai$ jupyter notebook
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 <module>
    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 "<decorator-gen-7>", 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

I am not sure what to do. Thanks a lot for the help, I can’t wait to get started.

After some more searching through the forum, I found these proposed solutions. Conda env update error on Paperspace

I’ll try those out first and let you know what worked.

Thanks @willismar, changing c.NotebookApp.ip to “0.0.0.0” worked for me

Thanks, the python notebook errors go away and I obtain a url. Pasting it in my browser, and replacing ‘localhost’ with my machine’s ip address, is not working though. The site can’t be reached. What am I doing wrong here?

Now that you can start jupyter correctly you need to look at the configurations of your cloud how can you create a rule to accept inbond connection from remote IP to internal IP in that specific port are you using…

You will probably have to use 0.0.0.0 or set your internal IP address on the jupyter and have this rule on the firewall to enable you to reach your papaspace. I personally don’t use cloud computing but all of them has some way to enable it. Try to look for a tutorial in how to enable ports and inbound connections to instance.

Thanks a lot for your help. I have to admit, I do not have much experience and having difficulty to understand your answer and breaking it down into steps I can take. If there is anyone around who could point me to a thread that describes the same issues I have, that would be much appreciated.

After a fresh install of the a Fast.ai Linux template on PaperSpace, following these instructions https://github.com/reshamas/fastai_deeplearn_part1/blob/master/tools/paperspace.md I also got the Connection refused error message from my Chrome browser from my home computer.

I have just changed 1 line in the Jupyter config file:
vi .jupyter/jupyter_notebook_config.py
Change this line: # c.NotebookApp.ip = ‘localhost’
To this one: c.NotebookApp.ip = ‘*’

Relaunch the Jupyter Notebook server and the remote connection from my home browser works fine.

1 Like

Hi @VincentPommier,

Thank you for reach me out. I do appreciate your answer. :slight_smile:
I know the config file very well but because I don’t install anything directly on my host anymore (I started to use containers in 2016) then to me is much faster just set an argument in front a adhoc command / alias instead of editing spots on a configuration file. just like that.

So every time I launch a new container I just run this line once:

export JUPYTER_SECRET=$(python3 -c "from notebook.auth import passwd; print(passwd(algorithm='sha256'))") 

And put this others on my bash initialization. Each container I launch get a different IP and even if the network changes I get the new router IP there:

export JUPYTER_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # sha256
export JUPYTER_PORT=8888
export JUPYTER_IP=$(ip route get 8.8.8.8 | head -1 | cut -d" " -f8)
alias jlab="jupyter lab --port=$JUPYTER_PORT --ip=$JUPYTER_IP --no-browser --NotebookApp.password=$JUPYTER_SECRET  --NotebookApp.notebook_dir=/projects --allow-root "

Thank you again.

If you still have problems with this and don’t found another thread that can help you.

I suggest you read a little more about jupyter server here:

https://jupyter-notebook.readthedocs.io/en/stable/public_server.html

So that can clarify any of your problems running it.