3

I am using the Ubuntu sub-system on Windows 10.

I opened a terminal and entered the command:

jupyter notebook 

and then a notebook is started at port 8888. Without closing this one, I opened another terminal and typed in jupyter notebook again, the new terminal says that:

[I 15:09:00.576 NotebookApp] The Jupyter Notebook is running at:
[I 15:09:00.577 NotebookApp] http://localhost:8888/?token=

with a different token number from the notebook running in the first terminal. If I open localhost:8888 with my browser and enter the token from the second terminal, jupyter rejects me, while the token from the first terminal passes.

I was wondering why can there be two notebooks running on the same 8888 port? If I kill the notebook in the second terminal, will it affect the notebook running in the first terminal?

Jinhua Wang
  • 1,679
  • 1
  • 17
  • 44
  • 1
    if you open a new notebook it will need to be a different port. It will throw this error: The port 8888 is already in use, trying another port/ – MEdwin Nov 09 '18 at 15:24

1 Answers1

3

Short answer - you can't have 2 notebooks server running on the same port.

From Jupyter documentation:

You can start more than one notebook server at the same time, if you want to work on notebooks in different directories. By default the first notebook server starts on port 8888, and later notebook servers search for ports near that one. You can also manually specify the port with the --port option.

This is probably a networking issue or caused by your environment configuration. Basically, For TCP/IP you can only have one application listening on the same port at one time. Now if you had 2 network cards, you could have one application listen on the first IP and the second one on the second IP using the same port number. For UDP (Multicasts), multiple applications can subscribe to the same port.

You can always run the second server with --port option and port of your choosing.

Raoslaw Szamszur
  • 1,723
  • 12
  • 21
  • But if I can't have two notebooks running on the same port, why would the second notebook successfully start and tells me that it is listening on 8888? If I remember correctly, on mac osx, it will simply choose a different port (like 8889) by default. – Jinhua Wang Nov 09 '18 at 15:21
  • You shouldn't be possible to run 2 Jupiter servers on the same port. This issue is strange. But just to clarify you running both jupyter servers on VM upon Win10 ? – Raoslaw Szamszur Nov 09 '18 at 15:25
  • Window's now include a distribution of Ubuntu - you can download it from the app store. I don't think it is a VM. – Jinhua Wang Nov 09 '18 at 15:26
  • @JinhuaWang Well then this may be the cause. I woudl suggest to use VM :). Or just specify --port for the second jupyter notebook. – Raoslaw Szamszur Nov 09 '18 at 15:28
  • @JinhuaWang This issue is strange because TCP/IP doesn't allow to listen on a certain port by more than one application. – Raoslaw Szamszur Nov 09 '18 at 15:35