0

I'm working on a remote machine using SSH login. When trying to open the jupyter notebook in the virtual environment called balancing_selection, using the following command:

jupyter-notebook --no-browser --port=8887

I get the following error:

 Traceback (most recent call last):
      File "/home/homap/miniconda3/envs/balancing_selection/bin/jupyter-notebook", line 11, in <module>
        sys.exit(main())
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
        return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
        app.initialize(argv)
      File "</home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/decorator.py:decorator-gen-7>", line 2, in initialize
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
        return method(app, *args, **kwargs)
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/notebook/notebookapp.py", line 1679, in initialize
        self.init_webapp()
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/notebook/notebookapp.py", line 1442, in init_webapp
        self.http_server.listen(port, self.ip)
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/tornado/tcpserver.py", line 151, in listen
        sockets = bind_sockets(port, address=address)
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/tornado/netutil.py", line 174, in bind_sockets
        sock.bind(sockaddr)
    OSError: [Errno 99] Cannot assign requested address

How could I solve this issue?

ode2k
  • 2,653
  • 13
  • 20
Homap
  • 2,142
  • 5
  • 24
  • 34

1 Answers1

2

You may need to specify the IP of your localhost (VM)

jupyter-notebook --no-browser --ip=127.0.0.1 --port=8887

or

jupyter-notebook --no-browser --ip=0.0.0.0 --port=8887  # all interfaces on host

It's also possible that your /etc/hosts file has localhost set incorrectly. The localhost should be pointed to the IPv4 address, and IPv6 should be created as a separate entry for the IPv6 loopback.

127.0.0.1       localhost.localdomain    localhost
::1             localhost6.localdomain6  localhost6 
ode2k
  • 2,653
  • 13
  • 20