Giter Site home page Giter Site logo

Comments (20)

colaboratory-team avatar colaboratory-team commented on June 24, 2024 72

Were you using Colaboratory from a different browser or user profile than your local Jupyter instance?

This extension uses Jupyter's token authorization flow, which sets an authorization cookie in your browser. If the cookie isn't present when Colaboratory attempts a connection, you'll see behavior like you described.

To help prevent issues like these from cropping up, you could start your Jupyter server using the --no-browser flag and open the provided link that appears in the terminal from the same browser that you currently have Colaboratory open in.

Example:

jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' \
  --port=9090 --no-browser

from jupyter_http_over_ws.

XericZephyr avatar XericZephyr commented on June 24, 2024 24

I get a similar issue where even adding --no-browser cannot fix that problem.

A potential (but not safe at all) solution is by adding --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True.

My final running command looks like:

jupyter notebook --no-browser --allow-root --NotebookApp.allow_origin='https://colab.research.google.com' --NotebookApp.token=''  --NotebookApp.disable_check_xsrf=True

from jupyter_http_over_ws.

talk2sunil83 avatar talk2sunil83 commented on June 24, 2024 8

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

worked for me chrome : 78.0.3904.108 win 10 : 1909 update

from jupyter_http_over_ws.

debsahu avatar debsahu commented on June 24, 2024 3

Ok got it working! It was the ad blockers. Had to disable them to get this working, add that info to the README?

from jupyter_http_over_ws.

els-pnw avatar els-pnw commented on June 24, 2024 1

This is super frustrating I have even attempted to use the disable_check_xsrf, disabled my Norton software and disabled my MacOS firewall and still nothing. BTW the firewall is not the problem because this works just fine in Chrome with the normal suggested jupiter notebook command.

jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=9090 --NotebookApp.port_retries=0 --no-browser --NotebookApp.disable_check_xsrf=True --NotebookApp.token=''

Does not work on Safari

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

Does not work on Safari
Does work in Chrome

When attempting with Safari, the terminal window where I executed jupyter notebook does not show any STDERR or STDOUT, the browser window simply and immediately returns a could not connect... troubleshoot message with NO details.

from jupyter_http_over_ws.

debsahu avatar debsahu commented on June 24, 2024

I completely disabled my firewall/antivirus. It is the same browser (chrome), that https://colab.research.google.com was open. Just for testing I did issue the command suggested above with --no-browser option, I get the same errors. I closed everything and used firefox as well (enabling network.websocket.allowInsecureFromHTTPS) and the same result.

jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=9090
 --no-browser
jupyter_http_over_ws extension initialized. Listening on /http_over_websocket
[I 17:57:49.410 NotebookApp] JupyterLab beta preview extension loaded from C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab
[I 17:57:49.410 NotebookApp] JupyterLab application directory is C:\ProgramData\Anaconda3\share\jupyter\lab
[W 17:57:49.434 NotebookApp] Error loading server extension jupyterlab
    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\commands.py", line 321, in __init__
        self._run(['node', 'node-version-check.js'], cwd=HERE, quiet=True)
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\commands.py", line 1165, in _run
        proc = Process(cmd, **kwargs)
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\process.py", line 73, in __init__
        self.proc = self._create_process(cwd=cwd, env=env)
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\process.py", line 131, in _create_process
        cmd[0] = which(cmd[0], kwargs.get('env'))
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\jlpmapp.py", line 59, in which
        raise ValueError(msg)
    ValueError: Please install nodejs 5+ and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1454, in init_server_extensions
        func(self)
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\extension.py", line 111, in load_jupyter_server_extension
        info = get_app_info(app_dir)
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\commands.py", line 244, in get_app_info
        handler = _AppHandler(app_dir, logger)
      File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\commands.py", line 324, in __init__
        raise ValueError(msg)
    ValueError: Please install nodejs 5+ and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.
[I 17:57:49.648 NotebookApp] Serving notebooks from local directory: C:\programdata\Anaconda3
[I 17:57:49.649 NotebookApp] 0 active kernels
[I 17:57:49.650 NotebookApp] The Jupyter Notebook is running at:
[I 17:57:49.650 NotebookApp] http://localhost:9090/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[I 17:57:49.651 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:57:49.654 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:9090/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[W 18:00:21.655 NotebookApp] Forbidden
[W 18:00:21.657 NotebookApp] 403 GET /api/kernelspecs (::1) 3.00ms referer=None

from jupyter_http_over_ws.

debsahu avatar debsahu commented on June 24, 2024

I used simple websocket client and connected to ws://localhost:9090/http_over_websocket?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx and it connects, even though the origin was localhost and not https://colab.research.google.com! So either way, the websocket component is working from Jupyter's perspective.
image

Do you think my network provider is blocking certain ports from colab? I will retry on a private network. same result on private network

from jupyter_http_over_ws.

siddu541 avatar siddu541 commented on June 24, 2024

I'm getting below error,need help to trobleshoot

image

from jupyter_http_over_ws.

rvigneshw avatar rvigneshw commented on June 24, 2024

I'm also getting this it keep saying connecting but at the end this dialog shows up!

from jupyter_http_over_ws.

SilvioJin avatar SilvioJin commented on June 24, 2024

I've followed the steps in here and checked on the issues on this page, but still can't connect to local.

By using:

jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' \
>   --port=9090 --no-browser

response is:

jupyter_http_over_ws extension initialized. Listening on /http_over_websocket
JupyterLab beta preview extension loaded from /Users/myUser/anaconda3/lib/python3.6/site-packages/jupyterlab
JupyterLab application directory is /Users/myUser/anaconda3/share/jupyter/lab
Serving notebooks from local directory: /Users/myUser
0 active kernels
The Jupyter Notebook is running at:
http://localhost:9090/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
    
    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:9090/?token= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&token= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

So I copy and paste
http://localhost:9090/?token= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&token= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
in my browser (Safari) and get the page response:
302 GET /?token= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&token= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (::1) 1.56ms
But when I go on Colab and try to connect to local runtime (with the right port 9090 in this case) it says: Unable to connect to the runtime. Troubleshoot.

And it asks me to check:

  1. Ensure the jupyter_http_over_ws Jupyter extension is enabled and up to date on your machine.
    pip install --upgrade jupyter_http_over_ws>=0.0.1a3 && \ jupyter serverextension enable --py jupyter_http_over_ws

  2. Ensure the notebook server on your machine is running on port 9090 and accepting requests from https://colab.research.google.com.
    jupyter notebook \ --NotebookApp.allow_origin='https://colab.research.google.com' \ --port=9090 \ --NotebookApp.port_retries=0
    which I tried but have the same results.

About jupyter_http_over_ws in my system, it shows:

pip show jupyter_http_over_ws

Name: jupyter-http-over-ws
Version: 0.0.6
Summary: Jupyter support for HTTP-over-ws
Home-page: https://github.com/googlecolab/jupyter_http_over_ws
Author: Google Colaboratory team
Author-email: [email protected]
License: Apache 2.0
Location: /Users/myUser/anaconda3/lib/python3.6/site-packages
Requires: six, notebook, tornado, enum34
Required-by: 

This happens for any notebook on Colab, even with a new one or with just markdown or import package

from jupyter_http_over_ws.

tamaradanceva avatar tamaradanceva commented on June 24, 2024

Hi, has anyone found an alternative solution to disable_check_xsrf? Disabling the ad blockers does not solve the problem for me.

from jupyter_http_over_ws.

colaboratory-team avatar colaboratory-team commented on June 24, 2024

Colaboratory attempts to make a connection to your local kernel using a WebSocket (ws://). Safari disallows connections from HTTPS domains using insecure WebSockets. Due to this, you won't be able to connect to your local kernel using Safari.

We'll work to update our documentation and error handling to try and make this more clear. An additional place to look when encountering issues like this is in the console of your browser's developer tools.

from jupyter_http_over_ws.

acarl005 avatar acarl005 commented on June 24, 2024

I had this issue because I had disabled 3rd party cookies. Fixed by enabling them.

from jupyter_http_over_ws.

cmp1 avatar cmp1 commented on June 24, 2024

My colab notebook has suddenly stopped connecting to jupyter runtime - does anyone know how to fix this? I get the same connection output as below

I'm getting below error,need help to trobleshoot

image

from jupyter_http_over_ws.

geraldonwujekwe avatar geraldonwujekwe commented on June 24, 2024

Thank you talk2sunil83. It also worked for me after hours of trying other solutions.

from jupyter_http_over_ws.

beerpulse avatar beerpulse commented on June 24, 2024

@colaboratory-team I still could not connect (Windows 10, Chrome 81 beta, Anaconda3) after following troubleshooting steps, updating jupyter config, spending an hour on it. The command from @talk2sunil83 worked like a charm. Perhaps this command should be added as an alternative step to try in the official troubleshooting document?

from jupyter_http_over_ws.

cmp1 avatar cmp1 commented on June 24, 2024

Fixed it. The only option for me was to remove the password from the jupyter config file (the one you set when you first open jupyter notebooks) and simply copy and paste the generated token into the backend url when connecting to colab.

from jupyter_http_over_ws.

loukad avatar loukad commented on June 24, 2024

The password in the jupyter config file was my problem too. Removing the password fixed it. Thanks @cmp1 !

from jupyter_http_over_ws.

R-N avatar R-N commented on June 24, 2024

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

worked for me chrome : 78.0.3904.108 win 10 : 1909 update

I tried this but still can't connect

[I 13:09:14.093 NotebookApp] 302 GET / (::1) 0.00ms
[I 13:09:14.096 NotebookApp] Refusing to serve hidden directory, via 404 Error
[W 13:09:14.098 NotebookApp] 404 GET /tree (::1) 2.00ms referer=None
[E 13:09:14.098 NotebookApp] Uncaught error when proxying request
Traceback (most recent call last):
File "c:\python\python37\lib\site-packages\jupyter_http_over_ws\handlers.py", line 180, in _attach_auth_cookies
parsed_auth_url, self.ca_certs, self._get_http_client())
File "c:\python\python37\lib\site-packages\tornado\gen.py", line 1055, in run
value = future.result()
File "c:\python\python37\lib\site-packages\tornado\concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "", line 4, in raise_exc_info
File "c:\python\python37\lib\site-packages\tornado\gen.py", line 1069, in run
yielded = self.gen.send(value)
File "c:\python\python37\lib\site-packages\jupyter_http_over_ws\handlers.py", line 535, in _perform_request_and_extract_cookies
raise response.error
tornado.httpclient.HTTPError: HTTP 404: Not Found
[E 13:09:14.099 NotebookApp] Couldn't attach auth cookies

from jupyter_http_over_ws.

AIWithShrey avatar AIWithShrey commented on June 24, 2024

Is Safari one of the supported browsers at all? I've been trying all the mentioned solutions above, but all my attempts were in vain. Any help is appreciated, thank you!

from jupyter_http_over_ws.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.