首页 > 解决方案 > IPython(jupyter)中的完成现在可以工作(意外的关键字参数'column')

问题描述

我正在使用 jupyter notebook,它工作正常,但是当我按 TAB 时,自动完成不起作用。我已经在 StackOverflow 中检查了所有类似的案例,但没有一个解决方案对我有用。我也尝试过对 IPython、IPYKernel、Jedi 和 Tornado 进行“pip 升级”,升级工作正常,但问题仍然存在。我在 Firefox、Chrome 和 Edge 中尝试过。当我按 TAB 时,我可以在终端中看到这些错误:

[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\ipykernel\kernelbase.py", line 265, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\tornado\gen.py", line 234, in wrapper
    yielded = ctx_run(next, result)
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\ipykernel\kernelbase.py", line 580, in complete_request
    matches = yield gen.maybe_future(self.do_complete(code, cursor_pos))
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\ipykernel\ipkernel.py", line 356, in do_complete
    return self._experimental_do_complete(code, cursor_pos)
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\ipykernel\ipkernel.py", line 381, in _experimental_do_complete
    completions = list(_rectify_completions(code, raw_completions))
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\IPython\core\completer.py", line 484, in rectify_completions
    completions = list(completions)
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\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 "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\IPython\core\completer.py", line 1861, in _completions
    matched_text, matches, matches_origin, jedi_matches = self._complete(
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\IPython\core\completer.py", line 2029, in _complete
    completions = self._jedi_matches(
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\IPython\core\completer.py", line 1373, in _jedi_matches
    interpreter = jedi.Interpreter(
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\jedi\api\__init__.py", line 725, in __init__
    super().__init__(code, environment=environment,
TypeError: __init__() got an unexpected keyword argument 'column'

如果有人能帮我处理这个案子,我会很高兴

标签: pythonjupyter-notebookipythonjupyterjupyter-lab

解决方案


@techno1731 的解决方案是次优的,因为它只是禁用绝地而不是解决根本问题。

最新的 jedi (0.18) 版本与 IPython 7.19 不兼容,请参阅此讨论。IPython:7.20(2020 年 2 月 1 日发布)和 8.0(尚未发布)具有兼容性修复。

此时正确的解决方法是升级 IPython:

pip install -U "ipython>=7.20"

将来,您可以在删除特定于您的安装的所有路径片段后搜索引用的最后两行,这是搜索:

     super().__init__(code, environment=environment,
TypeError: __init__() got an unexpected keyword argument 'column'

这将在今天的前两个 Google 结果中为您提供 GitHub 上的相关问题。

注意:这是我对Giant IPKernelApp Error Using Hydrogen in Atom问题的回答的副本,考虑到 Hydrogen/Atom 设置,它确实看起来不相关。我现在将投票结束关于该主题的所有其他问题,作为这个问题的重复。


推荐阅读