Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter Notebook authentication token while in Pycharm

I am trying to use the Jupyter notebook in Pycharm, but I realized that in the new Jupyter update, there was the addition of tokens.

I am following the tutorial below from JetBrains.

With all the settings initiated with the virtual environment created and setting the URL as 127.0.0.1:8888, however, when I click on the run cell button, it follows that I get the following message from Jupyter Notebook asking:

Please, enter your Jupyter Notebook URL and authentication token

like this:

PyCharm error message: Enter Jupyter Notebook URL authentication token

I looked it up on the Jupyter update blog and it says that my web browser should be initiated which generates a token for access, but I do not see that my browser is loaded here.

Help would be greatly appreciated here.

like image 321
PutsandCalls Avatar asked Jan 19 '17 07:01

PutsandCalls


People also ask

Why is Jupyter asking for a token?

If you enable a password for your notebook server, token authentication is not enabled by default, and the behavior of the notebook server is unchanged from versions earlier than 4.3. When token authentication is enabled, the notebook uses a token to authenticate requests.

How do I find my Jupyter token?

Just right click on the jupyter notebook logo in the currently running server, you probably have a server running already, then click on copy link, then paste the link in a text editor, maybe MS word, you will see the token in the link, copy and paste where token is required. It will work. Show activity on this post.


2 Answers

Running jupyter notebook list will display all of the running servers on your machine. So doing this in the terminal after starting a cell in PyCharm will result in output similar to Currently running servers: http://127.0.0.1:8888/?token=f85145dda03dc598bbbfa6e53b93cbcb27629ea00cfd2105 :: /home/.... which contains the appropriate token for authenticating.

like image 87
patemotter Avatar answered Sep 19 '22 16:09

patemotter


  1. Edit/enter the URL as: http://localhost:8888 (remove "?token=" at the end) and click OK.
  2. A bubble prompt will appear near the top of your PyCharm window, saying "Cannot connect to Jupyter Notebook. Run Jupyter Notebook". It should look like this (depending on your color scheme):

PyCharm prompt: Cannot connect to Jypyter Notebook. Run Jupyter Notebook

  1. Click on the link: "Run Jupyter Notebook"
  2. PyCharm will start the Jupyter server for you and it will create a new token. Look at View -> Tool Windows -> Run, to see details of the new token, and an optional URL to open in a web browser.

More info: https://www.jetbrains.com/help/pycharm/using-ipython-jupyter-notebook-with-pycharm.html

like image 23
Mr-IDE Avatar answered Sep 21 '22 16:09

Mr-IDE