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


#1

using: ec2-34-210-124-80.us-west-2.compute.amazonaws.com:8888

I ssh’d into my instance successfully, ran “nvidia-smi” successfully and ran Jupyter Notebook (I think successfully):

ssh -i /(mylocation)/(mykey).pem ubuntu@ec2-34-210-124-80.us-west-2.compute.amazonaws.com

$ jupyter notebook
[I 22:13:19.027 NotebookApp] [nb_conda_kernels] enabled, 2 kernels found
[I 22:13:19.031 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[W 22:13:19.057 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 22:13:20.713 NotebookApp] [nb_anacondacloud] enabled
[I 22:13:20.718 NotebookApp] [nb_conda] enabled
[I 22:13:21.074 NotebookApp] ✓ nbpresent HTML export ENABLED
[W 22:13:21.074 NotebookApp] ✗ nbpresent PDF export DISABLED: No module named nbbrowserpdf.exporters.pdf
[I 22:13:21.077 NotebookApp] Serving notebooks from local directory: /home/ubuntu
[I 22:13:21.077 NotebookApp] 0 active kernels
[I 22:13:21.077 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/
[I 22:13:21.077 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

Put this in the browser (copied the first part from the ssh):
ec2-34-210-124-80.us-west-2.compute.amazonaws.com:8888

But I got:
This site can’t be reached
ec2-34-210-124-80.us-west-2.compute.amazonaws.com took too long to respond.
Search Google for ec2 210 124 west compute amazonaws 8888
ERR_CONNECTION_TIMED_OUT

If I run which jupyter on my instance I get:
$ which jupyter
/home/ubuntu/anaconda2/bin/jupyter

I got the timeout using Chrome on my Mac, using Firefox on a Linux 14.02 desktop (with a vanilla installation), and in Chroe on my Android cell phone.

Note: originally I started a p2.xlarge (sized to 15GB) instance, and ran install-gpu.sh successfully, saved it as an ami, then ssh’d back in to the instance, ran the Jupyter Notebook, and got ERR_CONNECTION_TIMED_OUT, so I terminated the instance, started a new instance with the ami, everything came up fine, startup of Jupyter Notebook was fine (see output above), but again got the ERR_CONNECTION_TIMED_OUT.

Would building from install-gpu.sh make any difference?

Any ideas on what more I can try?


(Rajat Gupta) #2

I am also getting this problem.


(Benedikt S) #3

[W 22:13:19.057 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.

That sounds like that the jupyter notebook is configured for all IPs. :slight_smile:
(that was my problem in the beginning, that it allowed only localhost request)

  1. Maybe the security group of the AWS does not allow incomming request from your IP / at this port.
    Can you check, if the AWS security group allows all IP addresses for the port (8888)?
    You can go to the AWS console -> EC2 -> Security Group and check the security group, which your EC2 is attached to

  2. Is jupyter configured for the port 8888?

Bests,
Benedikt


#4

I discovered that I needed to set port 8888 to receive inbound traffic. The following worked for me:

Click on “Instances” (under “Instances”) in the left side panel.

Select your instance (the box to the left of “Name” and “Instance ID” should turn blue, and a set of information will be displayed in the lower part of the page. This information will include tags saying “Description”, “Status Checks”, “Monitoring” and “Tags”).

If you click on “Description” you should see information displayed. Next to “Security Groups” I see the following displayed in blue: “launch-wizard-10. view inbound rules”

Click on “view inbound rules” and I see a small window pop up that gives:
Ports Protocol Source Launch-wizard-10
22 tcp 0.0.0.0/0

This indicates that only Port 22 is open to Inbound information.

Next click on “Security Groups” (under “Network & Security”) in the left hand panel

I identified which of the Security Groups in the list was appropriate to my running instance by looking under the “Description” to see the one with today’s date (e.g. “launch-wizard-10 created 2017-06-29”).

I selected that one in the check box on the far left (the box turned blue).

Information appeared on the lower part of the page, including the tags saying “Description”, “Inbound”, “Outbound” and “Tags”.

Click on the “Inbound” tag.

In my case I only saw: “SSH TCP 22 0.0.0.0/0”

Click on “Edit”.

Click on “Add Rule” and a new row should appear.

Enter “8888” under “Port Range” and under “Source” select “Anywhere” which should change the value to “0.0.0.0/0, ::/0”.

Click on “Save”.

You should now see the following displayed in the lower part of the page:
Custom TCP Rule TCP 8888 0.0.0.0/0

This shows that port 8888 is open to inbound information, and you should be good to go. This worked for me.


(Rajat Gupta) #5

@jeremy
@benai @benediktschifferer I am still unable to solve this problem. I have done as what both of you have said.

My jupyter notebook starts at port 8888.


I have also check what @benai recommend in second point.
I am using ubuntu 16.04 but when I start the instance it shows 14.04, maybe it can help.

Please recommend something.


(Benedikt S) #6

Can you print the console output, when you start notebook jupyter?
Can you share your juypter configuration (without the password hash)?

  • AWS Security Group doesn’t allow inbound traffic from your pc (based on your screenshot, that should not be the case)
  • jupyter notebook doesn’t allow inbound traffic from your pc <- I think that could be the case
  • Maybe there are other problems, but it is though to find it out without more information

(Rajat Gupta) #7

I do not know how to get jupyter configuration. Please list me the steps to get it.

I also attach a screenshot to my previous post please take a look to it.
@jeremy @benediktschifferer


(Benedikt S) #8

Hi Rajat,

sorry, but I don’t know how to help.
The problems I know are:

  • AWS security groups deny the access
  • Jupyter is configured only for internal traffic.

The screenshot you posted shows:
“The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/” and
"Warning: The notebook server is listening on all IP adresses"
–> It looks that jupyter is configured to listen to your addresses

AWS secutiry groups:

  • benai shared a good stepwise explanation
  • I cannot evaluate it for your system. You can share screenshots about the security group (+ check if the EC2 instance uses the correct secutiry group)

Bests,
Benedikt


#9

I’m having the same problem - the “jupyter notebook” command works but then when I put the URL in the browser I get connection timed out error. I checked and security group rules and they are fine, 8888 is allowed. Anyone was able to solve and can assist?


(Atul) #10

Anyone able to resolve this issue??/Thanks


(Atul) #11

Are you able to resolve the issue?


(Diego Menin) #12

If you are sure that AWS is configured correctly for permissions, check if your network is not blocking the outbound traffic. You could try to do port tunneling when SSHing into your instance by doing:

ssh -i <your_key> <user@instance> -L 8888:127.0.0.1:8888

then you can access jupyter locally by going to localhost:8888 on your browser


(nok) #13

Does anyone solve this issue? I have the same problem


(DinoLew) #14

@nok
Please try some other ports, maybe your internet service block this port, you can try by
jupyter notebook --port=8989
or just edit the run.sh script download from fastai’s github by adding --port=8989 at ending
and run
sh run.sh
and don’t forget access using https scheme, that is
https://yourinstanceip:8989


(nok) #15

I try to use other port, but not able to solve it. The issue doesn’t exist when I am using others computer at home. How can I check if I am blocked by some internal firewall?


(V Soorya) #16

Thanks @dmenin This worked!


(kal) #17

Probably the original question might have been answered or solved. I encountered similar situation and had to recreate my instance which means I lost my notebooks. Which is why I always keep a copy of the notebooks in my github account.


(Sambhavi) #18

Maybe this problem is solved. But I have a weird one. Would help a lot if somebody can throw some light, am kind of stuck with this now for 2nd day.

I followed all steps as in AWS Setup video and was able to open and work on my jupyter notebook successfully. I stopped the instance end of day and next day when I start the instance and open my notebook, it works fine. But after an hour connection goes off. I tried all suggestions mentioned in the forum but no luck. End of day as usual stopped my instance and re-started it today morning. Like yesterday, it was fine for an hour and then connection went off, am unable to access my notebook from browser. But am able to ssh to the instance from cygwin. I use a t2.micro, selected us-west-2 as my region though I reside elsewhere (again based on my understanding of suggestions in forums).

Would appreciate any help on this!


(Disha) #19

This worked for me too!


(Ananth) #20

This worked, thank you!