Jupyter notebook fails to start

I’ve pulled fastai repo updates during the weekend and have run conda env update. The result is that jupyter notebook won’t start unless I uninstall docrepr package. My environment is nvidia-docker container with ubuntu 16.04 and Anaconda 5.0.1.

(fastai) root@fastai:/workspace/fastai.gt# jupyter notebook --allow-root --no-browser --ip=0.0.0.0
Traceback (most recent call last):
  File "/root/anaconda3/envs/fastai/bin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
  File "/root/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 "/root/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 "/root/anaconda3/envs/fastai/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/root/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py", line 1368, in initialize
    self.init_webapp()
  File "/root/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py", line 1161, in init_webapp
    self.jinja_environment_options
  File "/root/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py", line 154, in __init__
    base_url, default_url, settings_overrides, jinja_env_options)
  File "/root/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py", line 263, in init_settings
    nbextensions_path=jupyter_app.nbextensions_path,
  File "/root/anaconda3/envs/fastai/lib/python3.6/site-packages/notebook/notebookapp.py", line 874, in nbextensions_path
    from IPython.paths import get_ipython_dir
  File "/root/anaconda3/envs/fastai/lib/python3.6/site-packages/IPython/__init__.py", line 55, in <module>
    from .terminal.embed import embed
  File "/root/anaconda3/envs/fastai/lib/python3.6/site-packages/IPython/terminal/embed.py", line 15, in <module>
    from IPython.core.interactiveshell import DummyMod, InteractiveShell
  File "/root/anaconda3/envs/fastai/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 90, in <module>
    import docrepr.sphinxify as sphx
  File "/root/anaconda3/envs/fastai/lib/python3.6/site-packages/docrepr/sphinxify.py", line 53, in <module>
    CACHEDIR = tempfile.gettempdir() + osp.sep + 'docrepr-' + username
TypeError: must be str, not NoneType

Feel free to just remove that package - we don’t really need it. I’ll remove it from environment.yml

This is what I did.

From the call stack I’m hallucinating that docrepr helps formatting documentation snippets in ipython interactive console.

Hi,

Experiencing the same error with an added issue:

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

I have treid removing envrionment.yml but it is not really helping. Hope to seek your assistance…

Thank you!
Hazel

1 Like

I found a resolution for the bug regarding the ValueError. Here is my error:

(fastai) paperspace@ps5yydjaa:~/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

And here is how I fixed it…

Open up ~/.jupyter/jupyter_notebook_config.py and add this line to the very end:

c.NotebookApp.allow_remote_access = True

To do this in one single command you could even do the following:

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

Then jupyter notebook will start successfully. At least it did for me!

3 Likes

Hi Michael,

Awesome!! it works for me :slight_smile:
Thank you very much!

Hazel

Same problem appeared, after conda env update of fastai on local machine, Your fix worked, thanks!

exactly! thank you very much!!!

This actually solved one hidden error of mine. Earlier i used jupyter lab instead of jupyter notebook, because i am uanble to launch jupyter notebook. Though i am successful in launching jupyter lab, it redirected me to new error.
===== No Module name ‘bcolz’ ====== . To avoid this error i updated conda environment, still of no use. I have tried this answer in forums and it worked like magic.

Excellent! Thanks for posting!

YES! Thank you so much for your help.

Hi
Although this a a fix that works for the Paperspace etc. I have this issue in my local environment, and consider setting

allow_remote_access = True

to be a security issue.

I am trying to set a local environment with python = 3.7 and have followed the installation instructions played out in the documents for V1 in a virtual environment. The only difference with other environments are fastai 0.7 and python 3.6 in which the command

jupyter notebook

work fine. Any ideas where this difference is in the environments. which must read the same ~/.jupyter config file.

EDIT…

A solution posted here

Regards