Search code examples
pythonjupyter-notebooktornadojupyter

jupyter notebook: error when specifying IP for server access


when i run

jupyter notebook --ip=172.17.67.24

in cmd under windows 7 professional i get the following error

C:\Users\nhs>jupyter notebook --ip=172.17.67.24
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\Scripts\jupyter-notebook-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_core\application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\traitlets\config\application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "C:\ProgramData\Anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1296, in initialize
    self.init_webapp()
  File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1120, in init_webapp
    self.http_server.listen(port, self.ip)
  File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\tcpserver.py", line 142, in listen
    sockets = bind_sockets(port, address=address)
  File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\netutil.py", line 197, in bind_sockets
    sock.bind(sockaddr)
OSError: [WinError 10049] The requested address is not valid in its context

jupyter versions are:

jupyter 1.0.0

jupyter_client 5.1.0

jupyter_console 5.2.0

jupyter_core 4.3.0

jupyterlab 0.27.0

jupyterlab_launcher 0.4.0

if i use '*' as ip everything works fine, but i dont want to use that option due to security issues. If i specify the ip in the config file it doesn't work either.

Any ideas why this doesn't work?


Solution

  • Unfortunately, it is not possible to specify a list of IPs for which access to your notebook will be allowed.

    What I would recommend instead is to use an authentification token. This way, you can launch the jupyter notebook server with ip = '*' and then give the token to your colleague and nobody else.

    See this link for more info: http://jupyter-notebook.readthedocs.io/en/stable/security.html