In this tutorial, we'll see how to solve a common JupyterLab problem: invalid server password. Usually we get this problem when we try to open a new Jupyter Notebook server.

Next steps will help you to solve issues related to Jupyter server password and configuration.

1. Set new password in JupyterLab

To set or reset the JupyterLab password we can use the next command:

jupyter server password

2. Set password in Jupyter Notebook

For the older versions of Jupyter Notebook and iPython we can try with the next command:

jupyter notebook password

3. Find Jupyter configuration

To find the Jupyter configuration files we can use the following command:

jupyter --path

The output is:

config:
    /home/user/.jupyter
    /home/user/PycharmProjects/Pandas-Exercises-Projects/venv/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /home/user/.local/share/jupyter
    /home/user/PycharmProjects/Pandas-Exercises-Projects/venv/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /home/user/.local/share/jupyter/runtime

We are interested in the folder: /home/user/.jupyter or simply - ~/.jupyter/. In this folder we have files like:

  • jupyter_notebook_config.json - check if there is password set
  • jupyter_server_config.json - check if there is password set
  • jupyter_notebook_config.py - the Jupyter password configuration

4. Create new config file

If the files are not present in folder: ~/.jupyter/ we can generate new Jupyter configuration by

jupyter notebook --generate-config

5. Set Jupyter token

Finally to change the Jupyter password configuration or add new authentication token we need to open file:
~/.jupyter/jupyter_notebook_config.py.

Uncomment line with c.NotebookApp.allow_password_change:

#  This can be set to false to prevent changing passwords from the UI/API.
#c.NotebookApp.allow_password_change = True

and add new token or disable authentication by:

## Token used for authenticating first-time connections to the server.
#  
#  When no password is enabled, the default is to generate a new, random token.
#  
#  Setting to an empty string disables authentication altogether, which is NOT
#  RECOMMENDED.
#c.NotebookApp.token = '<generated>'

uncommenting: #c.NotebookApp.token