Search code examples
pythonpycharmipythonjupyter-notebookjupyter

How to remove password for Jupyter Notebooks and set token again


I need to do this for Pycharm.

Here are the steps that I did which I'm not able to undo.

  1. I added a password for authentication using:

    $ jupyter notebook password

  2. I then used the below command to comment all the code in jupyter_notebook_config.py

    $ jupyter notebook --generate-config

  3. Then I removed the hashed password generated in the jupyter_notebook_config.json which now looks like this

    { "NotebookApp": { "password": "" } }

  4. I then did the following changes in jupyter_notebook_config.py file

    c.NotebookApp.password = ''
    c.NotebookApp.token = '< generated>'

  5. Now, There is no token getting generated and there is no password as well when I start the Jupyter notebook.

    Pycharm git:(master) ✗ jupyter notebook
    [I 21:53:35.158 NotebookApp] Serving notebooks from local directory: /Users/...
    [I 21:53:35.158 NotebookApp] 0 active kernels
    [I 21:53:35.158 NotebookApp] The Jupyter Notebook is running at:
    [I 21:53:35.158 NotebookApp] http://localhost:8888/?token=%3Cgenerated%3E

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
    http://localhost:8888/?token=%3Cgenerated%3E

Now, how do I make it like the way it was or how do I get the token back??

PS - I even tried jupyter notebook list, but still the same URL is coming. Also, I'm doing this on a mac, so please advise accordingly.


Solution

  • Hmm my config looks different.

    Just remove this file and it will default to making a token

    $ cat ~/.jupyter/jupyter_notebook_config.json
    {
      "NotebookApp": {
        "password": "sha1:d0a89f391169:9ca771c3518f845438693b938b39703ce1104eaf"
      }