Ipython: Socket Error 99 for ipython notebook

Created on 23 Jul 2014  路  13Comments  路  Source: ipython/ipython

when trying to open a notebook I get a socket error 99 "Cannot assign requested address". This happened after a system update, although Ipython was updated only from 2.1.0-62 to 2.1.0-63 (SuSE package) I checked the following without any sucess:

  1. checked if loopback device is running (it is with inet addr: Mask:
  2. checked with netstat -lp if standard port is already assigned (it was not)
  3. run a small test script to start tornado web server at port 8888, it worked
  4. Create a default profile and run ipython again
  5. Started ipython with explicit host and (random) port (ipython notebook --init --ip='localhost' --port=49151)
  6. Tried is as root
  7. Checked that the firewall is not blocking
  8. Checked that I am able to write to tmp (in case that is needed)

So I am at a loss what else I can do. Any pointer on what else I can do are appreciated.

The start-up message is
tmp/> ipython notebook --init --log-level=50 --ip='localhost' --port=49151 [15:46:39]
Traceback (most recent call last):
File "/usr/bin/ipython", line 5, in
File "/usr/lib/python2.7/site-packages/IPython/init.py", line 120, in start_ipython
return launch_new_instance(argv=argv, _kwargs)
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 563, in launch_instance
File "", line 2, in initialize
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, *args, *_kwargs)
File "/usr/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 320, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "", line 2, in initialize
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, _args, *_kwargs)
File "/usr/lib/python2.7/site-packages/IPython/core/application.py", line 381, in initialize
File "/usr/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 315, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "", line 2, in parse_command_line
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, _args, *_kwargs)
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 475, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "", line 2, in initialize_subcommand
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, _args, *_kwargs)
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 413, in initialize_subcommand
File "", line 2, in initialize
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
return method(app, _args, *_kwargs)
File "/usr/lib/python2.7/site-packages/IPython/html/notebookapp.py", line 745, in initialize
File "/usr/lib/python2.7/site-packages/IPython/html/notebookapp.py", line 632, in init_webapp
self.http_server.listen(port, self.ip)
File "/usr/lib64/python2.7/site-packages/tornado/tcpserver.py", line 116, in listen
sockets = bind_sockets(port, address=address)
File "/usr/lib64/python2.7/site-packages/tornado/netutil.py", line 103, in bind_sockets
File "/usr/lib64/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(
error: [Errno 99] Cannot assign requested address

My system configuration is
{'commit_hash': '681fd77',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path': '/usr/lib/python2.7/site-packages/IPython',
'ipython_version': '2.1.0',
'os_name': 'posix',
'platform': 'Linux-3.11.10-17-default-x86_64-with-SuSE-13.1-x86_64',
'sys_executable': '/usr/bin/python',
'sys_platform': 'linux2',
'sys_version': '2.7.6 (default, Nov 21 2013, 15:55:38) [GCC]'}

My tornado version is
Name: python-tornado/Version: 3.2.1-2.1/Arch: x86_64

Most helpful comment

And what if you try --ip=

All 13 comments

And what if you try --ip=


That works (should have thought of that). I put it into my ipython_notebook_config.py. I wonder though why the behaviour changed...
So from my side I could close this issue. Only if one could change the error message to something meaningful that points to the solution, I would keep this issue open. But maybe this problem is too specific...

Thanks a lot for the quick answer!

Copying explanation from #6191:

IPython listens on localhost by default. ought to behave the same, and does in almost all cases. Some cases where this can be handled differently include local proxies and/or firewalls (usually due to a configuration oversight, rather than an intentional difference in behavior). We have found cases where localhost works and 127 doesn't and vice versa, so there isn't an unambiguously correct answer for the default.

Do you have a firewall and/or proxy configuration? If so, do you control its configuration? I would describe this behavior as a bug in your network setup, but it may not be one that you have permission to fix.

Thank you, specifying solved the socket error for me as well

If you use it in cloud server, you can use --ip=

Thanks for keeping this issue on, I am setting up a notebook server on a cloud server. And specifying the listening ip as "" does solved this same problem.

Thanks, I had the same problem :)

thanks it solved it !

For people coming from search results: check your /etc/hosts for typos and ipv6 config. localhost should only point to ipv4 loopback (, not to ipv6 (::1). This can break other stuff, not only jupyter.

For example, this is wrong:
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
this is ok:
::1 localhost6 localhost6.localdomain6


@mlazowik Thanks a lot! This resolved my issue - I wonder how many others have this same issue but have opted for the solution. This is the correct solution (ensuring the hostname lookup table is correct). In my instance (Arch Linux), my /etc/hosts was "shipped" as follows:       localhost.localdomain    localhost
::1             localhost.localdomain    localhost

And I corrected it to the following:       localhost.localdomain    localhost
::1             localhost6.localdomain6  localhost6

If you use it in cloud server, you can use --ip=

For me (on mac) only the --ip= works the local running docker.

For my case, it is due to the /etc/hosts for duplicated ::1 loopback address in IPv6.
After commented out the second loopback address ::1, the error is gone.

Screenshot from 2019-12-14 16-32-13

@mlazowik I had the same problem with the same eventual solution, but found it interesting that man /etc/hosts has this in their example, which kept me from figuring out my issue (as a presumed authority recommends exactly what you're saying is problematic):

# The following lines are desirable for IPv4 capable hosts       localhost       thishost.mydomain.org  thishost


# The following lines are desirable for IPv6 capable hosts
::1             localhost ip6-localhost ip6-loopback

I dropped the localhost from the ::1 entry (keeping the other two) and all is good. I also assumed ip6 was an ipv6 keyword, but perhaps ip6-foo and foo6 are both fine (e.g. just some form of name mangling vs. the ipv4 equivalent)?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jwkvam picture jwkvam  路  4Comments

sataliulan picture sataliulan  路  4Comments

RinaldoB picture RinaldoB  路  3Comments

quchunguang picture quchunguang  路  3Comments

ipython picture ipython  路  3Comments