'localhost refused to connect at http://localhost:8890/

I was trying to use jupyter notebook on a server.

When the port 8888 is not in use, I type jupyter notebook --no-browser and open http://localhost:8888/ using chrome, it works.

However, when the post 8888 and 8889 are already in use, I will get this:

[I 14:24:59.971 NotebookApp] The port 8888 is already in use, trying another random port.

[I 14:24:59.972 NotebookApp] The port 8889 is already in use, trying another random port.

[I 14:25:00.032 NotebookApp] Serving notebooks from local directory: /

[I 14:25:00.032 NotebookApp] 0 active kernels

[I 14:25:00.032 NotebookApp] The IPython Notebook is running at: http://localhost:8890/

[I 14:25:00.032 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

When I open http://localhost:8890/ using chrome, it says

This site can’t be reached. localhost refused to connect."

http://localhost:8888/ is also not working.

How can I solve this problem? Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source