Reputation: 51
So I was trying to link Google Colab to Jupyter notebook installed on my linux (ubuntu) machine by following the instructions from Google here: https://research.google.com/colaboratory/local-runtimes.html
The notebook server started fine, but when connecting to it through Google Colab, the connection failed and I got the "Forbidden" error.
(base) my_user@sysmain:~$ jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0 --no-browser
jupyter_http_over_ws extension initialized. Listening on /http_over_websocket
[I 23:01:03.636 NotebookApp] JupyterLab extension loaded from /home/my_user/miniconda3/lib/python3.8/site-packages/jupyterlab
[I 23:01:03.636 NotebookApp] JupyterLab application directory is /home/my_user/miniconda3/share/jupyter/lab
[I 23:01:03.638 NotebookApp] Serving notebooks from local directory: /home/my_user
[I 23:01:03.638 NotebookApp] Jupyter Notebook 6.1.3 is running at:
[I 23:01:03.638 NotebookApp] http://localhost:8888/
[I 23:01:03.638 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 23:01:20.212 NotebookApp] 302 GET / (127.0.0.1) 0.68ms
[I 23:01:20.214 NotebookApp] 302 GET /tree (127.0.0.1) 0.45ms
[W 23:01:20.240 NotebookApp] Forbidden
[W 23:01:20.240 NotebookApp] 403 GET /api/kernelspecs (127.0.0.1) 0.56ms referer=None
[I 23:01:22.273 NotebookApp] 302 GET / (127.0.0.1) 0.29ms
[I 23:01:22.274 NotebookApp] 302 GET /tree (127.0.0.1) 0.40ms
[W 23:01:22.278 NotebookApp] Forbidden
[W 23:01:22.278 NotebookApp] 403 GET /api/kernelspecs (127.0.0.1) 0.48ms referer=None
There have been posts about this topic before (https://github.com/googlecolab/colabtools/issues/162) however adding --no-browser didn't fix the issue, as you can see by the command I put in.
thanks for any help!
Upvotes: 3
Views: 9096
Reputation: 2708
Pay attention to the url you are copying to "Local connection settings" in Google Colab. When you run jupyter notebook locally, an output like this is printed:
[I 15:23:07.292 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 15:23:07.296 NotebookApp]
To access the notebook, open this file in a browser:
file:///Users/<your-username>/Library/Jupyter/runtime/nbserver-56791-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=xyz....xyz
or http://127.0.0.1:8888/?token=xyz....xyz
You should copy the "exact" url displayed here, that is:
http://localhost:8888/?token=xyz....xyz
In fact, the token
here is in charge of the authentication so that you will not receive 403
anymore.
Upvotes: -1
Reputation: 31
I ran into this problem after configuring jupyter for password authentication in ~/.jupyter/jupyter_notebook_config.py. Commenting out these lines
c.NotebookApp.password
c.NotebookApp.password_required
turned off the password and caused Jupyter to use token-based authentication. Alternatively, if you add a line like this
c.NotebookApp.token = 'yourTokenValue'
then you can connect via http://localhost:PORT/?token=yourTokenValue
Upvotes: 3