Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running `jupyter notebook` gives me: OSError: [Errno 99] Cannot assign requested address #2427

Closed
peterwilli opened this issue Sep 21, 2017 · 9 comments

Comments

Projects
None yet
6 participants
@peterwilli
Copy link

commented Sep 21, 2017

Hi there,

I just started using Codenvy. I wanted to run jupyter notebook (http://jupyter.org) but it gave me the following error:

It could be that I am just not getting the concept right, I'm completely new to this program. If that's the case, please point me in the right direction 👍

Thanks!

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

Reproduction Steps:

  • Create a new workspace
  • Select ubuntu(latest) as OS
  • When inside the IDE, do:
sudo apt update
sudo apt install python3-pip
sudo pip3 install -vU setuptools
sudo pip3 install jupyter
jupyter notebook

Codenvy version: 5.17.0

OS and version: Not sure (it's on codenvy.io, no self-hosted)

Docker version: Also not sure

Codenvy cli.log output: N/a

@ghost

This comment has been minimized.

Copy link

commented Sep 21, 2017

jupyter notebook --ip=0.0.0.0 --port=8080

In dashboard, go to your workspace settings, runtime - dev machine - servers. Find URL that corresponds to 8080
image

@ghost ghost added the kind/question label Sep 21, 2017

@peterwilli

This comment has been minimized.

Copy link
Author

commented Sep 21, 2017

@eivantsov Thanks! It works! I was wondering why it works like this? (explicitly entering 0.0.0.0).
Also, bit off-topic, do you know how I can paste inside the command line of Codenvy? Thanks!

@peterwilli peterwilli closed this Sep 21, 2017

@ghost

This comment has been minimized.

Copy link

commented Sep 21, 2017

Ctrl+Shift+V or Shift+Insert

@peterwilli

This comment has been minimized.

Copy link
Author

commented Sep 21, 2017

For some reason Ctrl+Shift+V doesn't work on my ChromeBook. Shift+Insert I haven't been able to do on the chrome keyboard.

@chibby0ne

This comment has been minimized.

Copy link

commented Jun 14, 2018

I'm writing this here since it is one of the top Google results for this error message.
I was also having the same issue, where I needed to use the --ip=0.0.0.0 or --ip=127.0.0.1 option to launch jupyter. But then I checked the /etc/hosts file and noticed I had a typo in one of the addresses.
I had:

172.0.0.1         localhost
::1               localhost
127.0.0.1         ACTUALHOSTNAME.localdomain        ACTUALHOSTNAME

where ACTUALHOSTNAME is my machine actual hostname.

After I changed the first line from 172.0.0.1 to 127.0.0.1, I was able to successfully launch it without specifying the --ip option.

Perhaps what's happening is these cases, is that those two first lines associating the loopback IP with localhost hostname are not specified in the /etc/hosts file.

@nanselmo

This comment has been minimized.

Copy link

commented Aug 3, 2018

In case it's helpful, the version of Codeenvy I'm using has a Commands Palette.

First I used eivantsov's command to explicitly assign the ip and port under the Command Line section:
jupyter notebook --ip=0.0.0.0 --port=8080

Then I added the following under the Preview URL section:
http://${server.port.8080}

image

@chenygie

This comment has been minimized.

Copy link

commented Nov 29, 2018

jupyter notebook --ip 0.0.0.0 --no-browser --allow-root

@abukaj

This comment has been minimized.

Copy link

commented Jan 22, 2019

In my case --ip=127.0.0.1 works fine while --ip=localhost (or no --ip) fails with the error. I consider it strange as pinging localhost works:

$ ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.046 ms

Also, --ip=localhost.localdomain starts the server which replies to my browser with 403 HTTP error:

[W 21:23:14.333 NotebookApp] Blocking request with non-local 'Host' localhost.localdomain (localhost.localdomain:8888). If the notebook should be accessible at that name, set NotebookApp.allow_remote_access to disable the check.
[W 21:23:14.367 NotebookApp] 403 GET /tree?token=[censored] (127.0.0.1) 36.70ms referer=None
@smac89

This comment has been minimized.

Copy link

commented May 25, 2019

Had to edit my /etc/hosts file. Make sure you have the following atleast:

127.0.0.1    localhost <Your Hostname>
::1          ip6-localhost ip6-loopback

Replace <Your Hostname> with your hostname. You can find it with the command hostname 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.