sagar francis
sagar francis

Reputation: 59

"Unable to connect to the local runtime" in google colab

I'm trying to connect local run time but it's not connecting,

I used the troubleshooting dialog following commands:

pip install jupyter_http_over_ws
jupyter serverextension enable --py jupyter_http_over_ws

jupyter notebook \ --NotebookApp.allow_origin='https://colab.research.google.com --port=8888 \--NotebookApp.port_retries=0

Have tried the same above steps as said in below URL https://research.google.com/colaboratory/local-runtimes.html

Facing an issue 'Jupyter authentication cookie was not detected' Tried by disabling adblocker, antivirus and also using different port numbers. Below was the solution given by team

Navigate to http://localhost:8888 in a separate browser tab and follow the provided instructions. This will set a browser cookie used for authentication between the browser and the Jupyter notebook server.

But when I open the URL, it asks for a password(already set up) and then no further instructions are appearing.

Upvotes: 6

Views: 23395

Answers (3)

Ahwar
Ahwar

Reputation: 1861

This issue was raised in Github issues for Collaboratory: This answer helped me https://github.com/googlecolab/jupyter_http_over_ws/issues/1#issuecomment-557469128

According to this issue

start the jupyter notebook with the below command.

jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --NotebookApp.port_retries=0 --notebook-dir="" --no-browser --allow-root --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True --port=8888

then open the notebook by going to this URL.

localhost:8888

according to kris This may allow you to connect, but it basically disables all security features.

Then retry connecting to local runtime with Google Colab

If it does not solve your problem then try disabling AdBlock extension or app.

Upvotes: 7

Lojith Vinsuka
Lojith Vinsuka

Reputation: 1051

For Windows (10/11)

Method 1: Using git bash

follow these steps https://research.google.com/colaboratory/local-runtimes.html

Using git bash

Method 2: Using Windows terminal & Multiline commands

Install jupyter_http_over_ws

pip install jupyter_http_over_ws

enable the jupyter_http_over_ws jupyter extension (one-time)

jupyter serverextension enable --py jupyter_http_over_ws

Use multiline commands to start server and authenticate

jupyter notebook ^
  --NotebookApp.allow_origin='https://colab.research.google.com' ^
  --port=8888 ^
  --NotebookApp.port_retries=0

Using mutilines & Windows terminal

Method 3: Using single-line command & windows terminal

Install jupyter_http_over_ws

pip install jupyter_http_over_ws

enable the jupyter_http_over_ws jupyter extension (one-time)

jupyter serverextension enable --py jupyter_http_over_ws

Use single-line commands to start server and authenticate

jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0

Using Single line and windows terminal

Once the server has started, it will print a message with the initial backend URL used for authentication. Make a copy of this URL as you'll need to provide this in the next step.

enter image description here

Connect to the local runtime In Colaboratory, click the "Connect" button and select "Connect to local runtime...". Enter the URL from the previous step in the dialog that appears and click the "Connect" button. After this, you should now be connected to your local runtime.

enter image description here

Upvotes: 5

Bob Smith
Bob Smith

Reputation: 38579

There are several reasons why a local connection might fail. To gather more diagnosis information, click the 'troubleshoot' link in the notification that appears in the lower left of the screen.

It will look like this: enter image description here

I'd recommend following whatever steps are recommended there. If you get stuck, please update your original question with the diagnosis offered in the troubleshooting dialog.

Upvotes: 0

Related Questions