简体   繁体   English

在 google colab 中使用本地 jupyter 时出现问题

[英]problems using local jupyter with google colab

I am using jupyter notebook with google colab, on Ubuntu 20.04LTS with Python 3.8.5.我正在使用带有 google colab 的 jupyter 笔记本,在 Ubuntu 20.04LTS 和 Python 3.8.5 上。

Problems I face are:我面临的问题是:

  1. connection drops suddenly.连接突然断开。 I mean, to say, colab never executes a cell, instead it just keeps waiting.我的意思是说,colab 从不执行单元格,而是一直等待。 By waiting, I mean, the cell I run always looks like this通过等待,我的意思是,我运行的单元格总是看起来像这样在此处输入图像描述 and never turns into this:并且永远不会变成这样: 在此处输入图像描述 . . But, colab does say that I am connected to an instance:但是,colab 确实说我连接到一个实例: 在此处输入图像描述 . .
  2. everytime I write something and wait for autocomplete to show suggestions, I receive a TypeError that says, there was unexpected keyword argument 'column'.每次我写一些东西并等待自动完成来显示建议时,我都会收到一个TypeError说,有意外的关键字参数“列”。 Here's the complete error message right from the launch of jupyter:这是 jupyter 启动时的完整错误消息:
(piu_venv) ubuntu@ip-xxx-xxx-xxx-xxx:~/pump_it_up$ jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
jupyter_http_over_ws extension initialized. Listening on /http_over_websocket
[I 07:14:12.316 NotebookApp] Serving notebooks from local directory: /home/ubuntu/pump_it_up
[I 07:14:12.316 NotebookApp] Jupyter Notebook 6.2.0 is running at:
[I 07:14:12.316 NotebookApp] http://localhost:8888/?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1
[I 07:14:12.316 NotebookApp]  or http://127.0.0.1:8888/?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1
[I 07:14:12.316 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 07:14:12.319 NotebookApp] No web browser found: could not locate runnable browser.
[C 07:14:12.319 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///home/ubuntu/.local/share/jupyter/runtime/nbserver-11870-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1
     or http://127.0.0.1:8888/?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1
[I 07:14:19.632 NotebookApp] 302 GET /?token=0b923e1d3d46db65bf3fe322c20bc0e4f5515f243873e2f7 (127.0.0.1) 0.250000ms
[I 07:14:19.634 NotebookApp] 302 GET /tree?token=0b923e1d3d46db65bf3fe322c20bc0e4f5515f243873e2f7 (127.0.0.1) 0.330000ms
[W 07:14:19.657 NotebookApp] Forbidden
[W 07:14:19.657 NotebookApp] 403 GET /api/kernelspecs (127.0.0.1) 0.420000ms referer=None
[I 07:14:23.317 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.240000ms
[I 07:14:23.461 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.230000ms
[I 07:14:23.478 NotebookApp] Kernel started: 2442098f-efe2-44fa-8916-2b8081a4904b, name: python3
[I 07:14:23.968 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.270000ms
[I 07:14:23.971 NotebookApp] proxying WebSocket connection to: ws://localhost:8888/api/kernels/2442098f-efe2-44fa-8916-2b8081a4904b/channels?session_id=dd75a32fa4b4426587f78beb823c6122&jupyter_http_over_ws_auth_url=http%3A%2F%2Flocalhost%3A8888%2F%3Ftoken%3Dc5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1
[I 07:14:26.402 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.260000ms
[I 07:14:45.852 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.280000ms
[I 07:14:47.477 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.230000ms
[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 265, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/tornado/gen.py", line 762, in run
    value = future.result()
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/tornado/gen.py", line 234, in wrapper
    yielded = ctx_run(next, result)
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 580, in complete_request
    matches = yield gen.maybe_future(self.do_complete(code, cursor_pos))
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 356, in do_complete
    return self._experimental_do_complete(code, cursor_pos)
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 381, in _experimental_do_complete
    completions = list(_rectify_completions(code, raw_completions))
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/IPython/core/completer.py", line 484, in rectify_completions
    completions = list(completions)
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/IPython/core/completer.py", line 1818, in completions
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/IPython/core/completer.py", line 1861, in _completions
    matched_text, matches, matches_origin, jedi_matches = self._complete(
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/IPython/core/completer.py", line 2029, in _complete
    completions = self._jedi_matches(
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/IPython/core/completer.py", line 1373, in _jedi_matches
    interpreter = jedi.Interpreter(
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/jedi/api/__init__.py", line 725, in __init__
    super().__init__(code, environment=environment,
TypeError: __init__() got an unexpected keyword argument 'column'

Details about computer:电脑的相关资料:
This is actually an AWS EC2 instance(c5a.4xlarge) I have port mapped to my local laptop, to be able to use jupyter notebook on colab.这实际上是一个 AWS EC2 实例(c5a.4xlarge),我已将端口映射到本地笔记本电脑,以便能够在 colab 上使用 jupyter notebook。 Both my laptop and EC2 instance are running Ubuntu 20.04LTS.我的笔记本电脑和 EC2 实例都在运行 Ubuntu 20.04LTS。

Package versions: Package 版本:
I have installed jupyter on 16-Jan-2021 by doing pip3 install jupyter .我通过执行pip3 install jupyter So, I believe I got the latest version available and here are the package versions along with some dependencies of jupyter:所以,我相信我得到了最新版本,这里是 package 版本以及一些 jupyter 依赖项:

ipykernel==5.4.3
ipython==7.19.0
ipython-genutils==0.2.0
ipywidgets==7.6.3
jedi==0.18.0
Jinja2==2.11.2
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.11
jupyter-console==6.2.0
jupyter-core==4.7.0
jupyter-http-over-ws==0.0.8
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.0
kiwisolver==1.3.1
MarkupSafe==1.1.1
matplotlib==3.3.3
mistune==0.8.4
mpmath==1.1.0
nbclient==0.5.1
nbconvert==6.0.7
nbformat==5.1.2
nest-asyncio==1.4.3
notebook==6.2.0

How do I fix these issues?我该如何解决这些问题?

The second issue is caused by your jedi version.第二个问题是由您的jedi版本引起的。 You can fix it with:您可以使用以下方法修复它:

pip install --upgrade 'jedi<0.18.0'

Related issue & discussion: https://github.com/ipython/ipython/issues/12745#issuecomment-751892538相关问题和讨论: https://github.com/ipython/ipython/issues/12745#issuecomment-751892538

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM