Google colaboratory 本地运行时404获取

Google colaboratory 本地运行时404获取,google-colaboratory,Google Colaboratory,我正在尝试让google collab本地运行时正常工作,但当我尝试连接到本地服务器时,我得到: [I 10:17:23.142 NotebookApp] Serving notebooks from local directory: /home/adam/Documents/PYTHON/Complexity_Challenge/Spring_2018 [I 10:17:23.142 NotebookApp] 0 active kernels [I 10:17:23.142 NotebookA

我正在尝试让google collab本地运行时正常工作,但当我尝试连接到本地服务器时,我得到:

[I 10:17:23.142 NotebookApp] Serving notebooks from local directory: /home/adam/Documents/PYTHON/Complexity_Challenge/Spring_2018
[I 10:17:23.142 NotebookApp] 0 active kernels
[I 10:17:23.142 NotebookApp] The Jupyter Notebook is running at:
[I 10:17:23.142 NotebookApp] http://localhost:8891/
[I 10:17:23.142 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 10:17:33.609 NotebookApp] 404 GET /http_over_websocket (127.0.0.1) 50.27ms referer=None
404 GET在最后一行。我更改了jupyter_notebook_config.py中的设置,如中所述

编辑:在Bob的评论之后,我安装了软件包,然后打开一个笔记本并尝试连接。它仍然不起作用,但错误消息不同:

(python3) adam@Rilke ~/Documents/DATA/terry20180313 $ jupyter serverextension enable --py jupyter_http_over_ws
Enabling: jupyter_http_over_ws
- Writing config: /home/adam/.jupyter
    - Validating...
      jupyter_http_over_ws  OK
(python3) adam@Rilke ~/Documents/DATA/terry20180313 $ 
(python3) adam@Rilke ~/Documents/DATA/terry20180313 $ jupyter notebook
[I 12:58:33.319 NotebookApp] The port 8888 is already in use, trying another port.
[I 12:58:33.320 NotebookApp] The port 8889 is already in use, trying another port.
[I 12:58:33.320 NotebookApp] The port 8890 is already in use, trying another port.
[I 12:58:33.321 NotebookApp] The port 8891 is already in use, trying another port.
jupyter_http_over_ws extension initialized. Listening on /http_over_websocket
[I 12:58:33.341 NotebookApp] Serving notebooks from local directory: /home/adam/Documents/DATA/terry20180313
[I 12:58:33.341 NotebookApp] 0 active kernels
[I 12:58:33.341 NotebookApp] The Jupyter Notebook is running at:
[I 12:58:33.341 NotebookApp] http://localhost:8892/
[I 12:58:33.341 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[E 12:59:19.470 NotebookApp] Uncaught exception
    Traceback (most recent call last):
      File "/home/adam/anaconda2/envs/python3/lib/python3.4/site-packages/tornado/http1connection.py", line 238, in _read_message
        delegate.finish()
      File "/home/adam/anaconda2/envs/python3/lib/python3.4/site-packages/tornado/httpserver.py", line 289, in finish
        self.delegate.finish()
      File "/home/adam/anaconda2/envs/python3/lib/python3.4/site-packages/tornado/web.py", line 2047, in finish
        self.execute()
      File "/home/adam/anaconda2/envs/python3/lib/python3.4/site-packages/tornado/web.py", line 2067, in execute
        **self.handler_kwargs)
      File "/home/adam/anaconda2/envs/python3/lib/python3.4/site-packages/jupyter_http_over_ws/handlers.py", line 43, in __init__
        websocket.WebSocketHandler.__init__(self, *args, **kwargs)
      File "/home/adam/anaconda2/envs/python3/lib/python3.4/site-packages/tornado/websocket.py", line 127, in __init__
        super(WebSocketHandler, self).__init__(application, request, **kwargs)
      File "/home/adam/anaconda2/envs/python3/lib/python3.4/site-packages/tornado/web.py", line 185, in __init__
        self.clear()
      File "/home/adam/anaconda2/envs/python3/lib/python3.4/site-packages/tornado/web.py", line 289, in clear
        self.set_default_headers()
      File "/home/adam/anaconda2/envs/python3/lib/python3.4/site-packages/notebook/base/handlers.py", line 316, in set_default_headers
        self.set_header("Access-Control-Allow-Origin", self.allow_origin)
      File "/home/adam/anaconda2/envs/python3/lib/python3.4/site-packages/tornado/websocket.py", line 385, in _disallow_for_websocket
        if self.stream is None:
    AttributeError: 'HttpOverWebSocketHandler' object has no attribute 'stream'

该特定URL由Colab Jupyter扩展处理。你安装了吗

pip install jupyter_http_over_ws
jupyter serverextension enable --py jupyter_http_over_ws

(在启动Jupyter之前运行上述命令。)

确保已安装Colab“HTTP over WebSocket”Jupyter扩展(适用于用户
Jupyter
),并且版本高于0.0.7:

pip install --upgrade jupyter_http_over_ws>=0.0.7
启用Colab Jupyter HTTP over WebSocket扩展:

jupyter serverextension enable --py jupyter_http_over_ws
您可以通过以下方式运行Jupyter:

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

如果使用conda安装环境,请尝试通过conda安装jupyter_http_over_ws包:

conda install -c conda-forge jupyter_http_over_ws
然后,您应该能够使用以下命令启用serverextension:

jupyter serverextension enable --py jupyter_http_over_ws
之后,在PowerShell中运行以下代码,您将收到url,其中包含Colab的令牌代码:

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

谢谢Bob,我安装了扩展,现在出现了另一个错误。我编辑了原始问题并添加了信息。看起来您仍然有一台服务器在端口8888上侦听。要停止它,请运行
fuser-k 8888/tcp