Can’t connect to Jupyter Notebook (tried 3 different machines) ERR_CONNECTION_TIMED_OUT


(Vishnu Vemuru) #21

Wow, this works. Thanks a lot Diego.


(karenerobinson) #22

I had this problem too and did some investigation.

If @dmenin 's port forwarding solution works, that can mean that even though your security group is set to listen on the right ports, jupyter isn’t. (That’s what it meant for me.)

I verified this by running sudo netstat -nltp, which returned this:

$ sudo netstat -nltp 
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1177/sshd
tcp        0      0 127.0.0.1:8888          0.0.0.0:*               LISTEN      1859/python

The first line is for ssh (port 22). The 0.0.0.0 means it listens for ssh on any IP. The second line is for port 8888, but there it only listens on its localhost IP, 127.0.0.1.

If you want to dig further you can run ifconfig and you will probably see two another IP. For me it’s 10.0.0.10, which must be somehow magically mapped back to my “elastic IP” from AWS.

OK so to solve it you make jupyter notebook listen on both its IPs. I used this stackoverflow solution, which says to: check for jupyter notebook configuration file, in ~/.jupyter/ . If it’s not there, run jupyter notebook --generate-config. Then open the file in an editor and find the line to edit about IPs.

Then I realized that a better solution was to find the fast ai config file, which I found here (no guarantees that it’s up to date though):
https://raw.githubusercontent.com/anurag/fastai-course-1/master/jupyter_notebook_config.py


#23

Have the same problem, can’t connect to the jupyer notebook…


(Jim Bohnslav) #24

This worked for me as well! I had to figure out <your_key> and <user@instance> were. For posterity, <your_key> is the private key you created as part of a keypair to connect to AWS. You can follow this tutorial. In my case, <your_key> was id_rsa. user@instance is the user and public IP address of your amazon AWS instance. In my case, this meant ubuntu@52.87.***.***. Stars are for redaction.

In sum, my command was ssh -i id_rsa ubuntu@52.87.***.***-L8888:localhost:8888. Hope this helps!