Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSError: [Errno 99] Cannot assign requested address

Tags:

Trying to run jupyter notebook on a CentOS 7. It comes back with:

OSError: [Errno 99] Cannot assign requested address 

And the stack trace:

[user@desktop ~]$ jupyter notebook Traceback (most recent call last):   File "/home/use/anaconda3/bin/jupyter-notebook", line 6, in <module>     sys.exit(notebook.notebookapp.main())   File "/home/user/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py", line 267, in launch_instance     return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)   File "/home/user/anaconda3/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/user/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error     return method(app, *args, **kwargs)   File "/home/user/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 1296, in initialize     self.init_webapp()   File "/home/user/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 1120, in init_webapp     self.http_server.listen(port, self.ip)   File "/home/user/anaconda3/lib/python3.6/site-packages/tornado/tcpserver.py", line 142, in listen     sockets = bind_sockets(port, address=address)   File "/home/user/anaconda3/lib/python3.6/site-packages/tornado/netutil.py", line 197, in bind_sockets     sock.bind(sockaddr) OSError: [Errno 99] Cannot assign requested address 
like image 697
Zahra Avatar asked May 16 '18 15:05

Zahra


People also ask

Could not connect Errno 99 Cannot assign requested address?

Docker container [Errno 99] Cannot assign requested address Note that for Docker containers, either you need to run them in network_mode: host to use the host's network systemd, or you need to bind to the container's IP address.

What (): Cannot assign requested address?

This error is not specifically for macOS, it tells you that the provided IP is not available for your network or it's already in use. You should provide an assigned IP from your networks, you could execute hostname -I (or equivalent) to check them.


2 Answers

jupyter notebook --ip=127.0.0.1 --port=8888 

I had to simply set the ip/port params. The issue was likely caused because the default ip/port that it was previously trying to assign was already taken!

like image 180
Zahra Avatar answered Sep 19 '22 14:09

Zahra


In a remote VM, I solved the issue by

$ jupyter-notebook --ip=0.0.0.0 --port=8888 ...          Copy/paste this URL into your browser when you connect for the first time,     to login with a token:         http://0.0.0.0:8888/?token=1234567890abcdefghijklmnopqrstuvwxyz  (the token is for demo)      ... 

Note: do not assign the specific ip

then I can connect to jupyter notebook via:

http://your_vm_ip:8888/?token=1234567890abcdefghijklmnopqrstuvwxyz 

(replace 0.0.0.0 with your_vm_ip)

enter image description here

like image 45
蔡宗容 Avatar answered Sep 21 '22 14:09

蔡宗容