Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running 'ipython notebook' gets [Errno 49] Can't assign requested address

I'm on Mac OS 10.10.4. When I run ipython notebook from command line, it gives me an error Cannot bind to localhost, using 127.0.0.1 as default ip [Errno 49] Can't assign requested address:

Yans-MacBook-Pro:/ yanyang$ ipython notebook
[W 01:32:12.908 NotebookApp] Cannot bind to localhost, using 127.0.0.1 as default ip
    [Errno 49] Can't assign requested address
[I 01:32:12.912 NotebookApp] Serving notebooks from local directory: /
[I 01:32:12.913 NotebookApp] 0 active kernels 
[I 01:32:12.913 NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/
[I 01:32:12.913 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

It will cause more error later. How can I fix it?

localhost:~ yanyang$ lsof | grep 8888
Google      358 yanyang  txt      REG                1,4   16621568 26888859 /Users/yanyang/Library/Caches/Google/Chrome/Profile 5/Cache/data_4
Google      358 yanyang   90u     REG                1,4   16621568 26888859 /Users/yanyang/Library/Caches/Google/Chrome/Profile 5/Cache/data_4
Google      358 yanyang  205u     REG                1,4       3072 35352297 /Users/yanyang/Library/Application Support/Google/Chrome/Profile 5/Local Storage/http_127.0.0.1_8888.localstorage

Content of the file in the last line of the above block:

?????z!11?tableItemTableItemTableCREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL)[!}1indexsqlite_aut?S???widgets:http://127.0.0.1:8888/notebooks/Downloads/PhillyCrime.ipynb{}?*?Qwidgets:http://127.0.0.1:8888/notebooks/Users/yanyang/Downloads/PhillyCrime.ipynb{}
??X?
    ?widgets:http://127.0.0.1:8888/notebooks/Downloads/PhillyCrime.ipynb?&?Q    widgets:http://127.0.0.1:8888/notebooks/Users/yanyang/Downloads/PhillyCrime.ipynb
like image 439
Yan Yang Avatar asked Jan 31 '16 17:01

Yan Yang


1 Answers

Thanks to @Petesh, I can use ipython notebook temperately now, using the command below:

ipython notebook --ip=127.0.0.1

And for further solution, I found that in my Mac's "/etc/hosts", 127.0.0.1 is not set to localhost. That's the final solution.

like image 158
Yan Yang Avatar answered Oct 06 '22 08:10

Yan Yang