我在一个新的py环境里安装了jupyterlab后一直无法自动补全,可是原来的环境没这个问题,刚开始还以为是jupyter的版本问题,结果弄了好久也还是没用,最后看到了这篇博文才解决了,下面做个总结
首先我遇到的报错信息如下
[IPKernelApp] ERROR | Failed to open SQLite history /home/comp/18481086/.ipython/profile_default/history.sqlite (disk I/O error).
[IPKernelApp] ERROR | History file was moved to /home/comp/18481086/.ipython/profile_default/history-corrupt.sqlite and a new file created.
[IPKernelApp] ERROR | Failed to open SQLite history /home/comp/18481086/.ipython/profile_default/history.sqlite (disk I/O error).
[IPKernelApp] ERROR | History file was moved to /home/comp/18481086/.ipython/profile_default/history-corrupt.sqlite and a new file created.
[IPKernelApp] ERROR | Failed to open SQLite history /home/comp/18481086/.ipython/profile_default/history.sqlite (disk I/O error).
[IPKernelApp] ERROR | Failed to load history too many times, history will not be saved.
[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 265, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/tornado/gen.py", line 762, in run
value = future.result()
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/tornado/gen.py", line 234, in wrapper
yielded = ctx_run(next, result)
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/contextvars/__init__.py", line 38, in run
return callable(*args, **kwargs)
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 580, in complete_request
matches = yield gen.maybe_future(self.do_complete(code, cursor_pos))
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 356, in do_complete
return self._experimental_do_complete(code, cursor_pos)
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 381, in _experimental_do_complete
completions = list(_rectify_completions(code, raw_completions))
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/IPython/core/completer.py", line 484, in rectify_completions
completions = list(completions)
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/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/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/IPython/core/completer.py", line 1862, in _completions
full_text=full_text, cursor_line=cursor_line, cursor_pos=cursor_column)
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/IPython/core/completer.py", line 2030, in _complete
cursor_pos, cursor_line, full_text)
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/IPython/core/completer.py", line 1374, in _jedi_matches
text[:offset], namespaces, column=cursor_column, line=cursor_line + 1)
File "/home/comp/18481086/code/nni/nni_env/lib/python3.6/site-packages/jedi/api/__init__.py", line 726, in __init__
project=Project(Path.cwd()), **kwds)
TypeError: __init__() got an unexpected keyword argument 'column'
那篇文章里提到可能的原因是jedi
这个库的版本有问题,我的是0.18
,在我把他降级到0.17
之后问题就得到了解决。