IPython (jupyter) 中的完成现在可以正常工作(意外的关键字参数 'column')

Completion in IPython (jupyter) does now work (unexpected keyword argument 'column')

我用的是jupyter notebook,运行正常,但是当我按TAB键时,自动补全功能不起作用。 我已经在 Whosebug 中检查了所有类似的案例,但是 none 的解决方案对我有用。 我还尝试对 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'

如果有人能帮助我解决这个问题,我会很高兴

前段时间我在虚拟环境的机器上本地工作时遇到了与 Jupyterlab 相同的问题。

这是 Jedi 加载完成时速度太慢(或者更确切地说是永远花费)的问题,对我有用的是在笔记本顶部添加以下行(例如,您通常在其中进行导入):

# Jedi not working
%config Completer.use_jedi = False

这应该可以解决问题。

来自@techno1731 的解决方案不是最优的,因为它只是禁用了 jedi 而不是修复潜在的问题。

最新的绝地 (0.18) 版本与 IPython 7.19 不兼容,请参阅 this discussion。 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 的相关问题。

Note: this is a copy of my answer from question which indeed can appear unrelated given the Hydrogen/Atom setting. I will now vote to close all other questions on the topic as duplicate of this one.

在您的环境中完全卸载您的 jupyter。然后用conda安装jupyter notebook,让conda帮你解决依赖

第 1 步:完全卸载 jupyter。

python3 -m pip uninstall -y jupyter jupyter_core jupyter-client jupyter-console jupyterlab_pygments notebook qtconsole nbconvert nbformat

第 2 步:使用 conda 安装 jupyter notebook。

conda install -c conda-forge notebook 
conda install -c conda-forge nb_conda_kernels

重新启动您的笔记本。

我正在使用以前版本的绝地武士:

pip install jedi==0.17

对我有用。