Error "Unable to open Jupyter Notebook: Port 8888 is already in use"

Question:

I am getting following error when I run Jupyter Notebook:

(base) C:Usersramne>jupyter notebook
[I 01:19:00.648 NotebookApp] The port 8888 is already in use, trying another port.

And when I do netstat -ano | find Str “8888” , I get the following:

C:Usersramne>netstat -ano | findStr "8888"
TCP    127.0.0.1:8888         0.0.0.0:0              LISTENING       16024
TCP    [::1]:8888             [::]:0                 LISTENING       16024

I don’t know what the default connection of port 8888 is or what its behavior should be like. How do I fix this error so I can open Jupyter Notebook?

Answers:

You could use --port argument to instruct jupyter to start the notebook server on another port.

Use jupyter notebook --help command to view the complete list of options.

The port 8888 is used almost exclusively by Jupyter, and the fact that it’s in use indicates more than anything that you have another Jupyter session already running. I’m 99% certain you can just kill the task that’s using it, or you can run

jupyter notebook list

to see current notebooks. And as mentioned in the other answer you can run

jupyter notebook --port 8889

To run on a different port instead (replace 8889 by any other number you’d like).

Answered By: Hans Musgrave

On windows, you can kill the Jupyter notebook process with taskkill.
First display the list of processes with

tasklist                                   

Then kill the process with:

taskkill /F /PID  __process_id_number__

Then restart the notebook with:

jupyter notebook
Answered By: Paul Rougieux

It is easy. Just type in the browser ‘localhost:8888/tree’. You will get ur notebooks

Answered By: PCM
  1. Go to the scripts folder where python is installed

    C:UsersMyPCAppDataRoamingPythonPython39Scripts
    
  2. a) Check if jupyter notebook is installed:

    jupyter-notebook.exe
    

    b) And not, install it with :

    pip install notebook
    
    link to Install : https://jupyter.org/install
    
  3. Now, in console (cmd) run :

    jupyter-notebook
    
    with that it should already work and if it doesn't you may have the 
    same problem as me -> (4)
    
  4. It happened to me that jupyter does not open in the browser because it was
    configured to have a browser that I did not have, so i changed the configuration
    to a browser that did have. Go to folder runtime

    C:UsersMiLapAppDataRoamingjupyterruntime
    
    That is the link that jupyter uses to open in your browser. Now Open with 
    your browser :
    
          nbserver-7660-open.html
    

    This is video help me :

    https://www.youtube.com/watch?v=12qmxF337g4

Answered By: BlasF

use these commads

ss -plnt

then kill the process number that used the port

sudo kill -9 pid 
Answered By: Omar Abusabha

issue persisting after reboot and also on virtual env

(i am on ubuntu 18)

What happen was, I had the notebook also running outside of virtual env as well.

so after doing the stop and deleting the contents in runtime path, it was good after that.

open a new terminal

jupyter notebook list
jupyter notebook stop <port num>
jupyter --path

delete the contents in path

for good order, check in both environment after stopping the notebook

Answered By: invertedOwlCoding
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.