Jupyter notebook localhost error

I’m running Jupyter notebook on a windows 10 VM, locally. Every time I launch notebook, it launches the CMD prompt and says to access notebook via https://localhost:8888 or 127.0.0.1:8888 with the token behind it. When it launches in the web browser it gives me the “localhost refused to connect”. I do a netstat -a in cmd and not seeing anything listening on port 8888. Windows Defender firewall is turned off so that’s not block it. It works on my laptop but not on this VM. This VM is in Azure if that helps determine what the issue might be.
I’ve also tried starting jupyter using different ports and that did not help either.

Hi jilams,
It not really clear which localhost you are trying to access. The “localhost” is of the VM that is displayed when you launch jupyter notebook, you may be launching the web browser on your host which would be a different “localhost”. So you can try launching the web browser from the VM or try using the IP of the VM in your browser.

2 Likes

I’m launching the application inside of a VM which then launches localhost:8888 in a web browser. I’m not trying to remotely connect to the VM. It’s just not listening on that port and I can’t figure out why. I’ve seen other users have this issue on stackoverflow and there hasn’t been a solution to this

Hi Jilamas,
I encountered same issue where running Jupyter on windows server 2016 RDP jump host which is running in VM. when I try to access localhost inside VM does not work it refuses to connect localhost. I tried all possible solutions from internet,

  • Turn off firewall,
  • netstat -a: no port is listening at 8080, tried other port as well
  • tried to use VM ip but does not work.

any solution?