gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 19:07:22 33 4
gpt4 key购买 nike

我在 Ubuntu 20.04LTS 和 Python 3.8.5 上使用 jupyter notebook 和 google colab。
我面临的问题是:

  • 连接突然断开。我的意思是说,colab 从不执行单元格,而是一直等待。通过等待,我的意思是,我运行的单元格总是看起来像这样
    enter image description here
    并且永远不会变成这样:enter image description here .但是,colab 确实说我连接到一个实例:enter image description here .
  • 每次我写东西并等待自动完成显示建议时,我都会收到 TypeError也就是说,有意外的关键字参数“列”。以下是 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'

    电脑的相关资料:
    这实际上是一个 AWS EC2 实例(c5a.4xlarge),我已将端口映射到本地笔记本电脑,以便能够在 colab 上使用 jupyter notebook。我的笔记本电脑和 EC2 实例都在运行 Ubuntu 20.04LTS。
    软件包版本:
    我在 2021 年 1 月 16 日通过执行 pip3 install jupyter 安装了 jupyter .所以,我相信我得到了最新版本,这里是包版本以及 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
    我该如何解决这些问题?

    最佳答案

    第二个问题是由您的 jedi 引起的。版本。您可以使用以下方法修复它:

    pip install --upgrade 'jedi<0.18.0'
    相关问题及讨论: https://github.com/ipython/ipython/issues/12745#issuecomment-751892538

    关于python - 在 google colab 中使用本地 jupyter 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65747436/

    33 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com