Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 511
Jugal Anchalia Avatar asked Jan 12 '18 16:01

Jugal Anchalia


People also ask

How do I remove password from jupyter notebook?

Enter the password twice and copy the 'sha1:12345' code. ... and alter the password. Paste your 'sha' code and run jupyter notebook.

How do I get the jupyter notebook password or token?

If a generated token doesn't work well for you, you can set a password for your notebook. jupyter notebook password will prompt you for a password, and store the hashed password in your jupyter_notebook_config. json . New in version 5.0: jupyter notebook password command is added.

How can I get Jupyter authentication token?

1) open new Jupyter notebook in your browser. Look at the URL, there you can see your localhost (example: localhost:8889) and change the default one at PyCharm if necessary. 2) for the token, while you are in the browser press F12 and then Ctrl + F and search for 'token'.


1 Answers

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"
  }
like image 138
Peter Moore Avatar answered Oct 05 '22 09:10

Peter Moore