问题
I'm using jupyter notebook, and it works fine, but when I press TAB, the auto-completion doesn't work. I already checked all the similar cases in StackOverflow, but none of the solutions worked for me. I have also tried to do "pip upgrade" to: IPython, IPYKernel, Jedi, and Tornado, the upgrade works fine but the problem is still there. I tried in Firefox, Chrome and Edge. When I press TAB I can see those errors in the terminal:
[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'
I'll be glad if someone can help me with this case
回答1:
The from @techno1731 is sub-optimal because it just disables jedi rather than fixing the underlying issue.
The latest jedi (0.18) release is incompatible with IPython 7.19 see this discussion. IPython: 7.20 (released Feb 1st 2020) and 8.0 (not yet released) have a compatibility fix.
The correct workaround at this time is to upgrade IPython:
pip install -U ipython==7.20
In future you can search for the final two lines of the trackback after removing all path fragments specific to your installation, this is searching for:
super().__init__(code, environment=environment,
TypeError: __init__() got an unexpected keyword argument 'column'
This will give you the relevant issues on GitHub in the first two Google result as for today.
Note: this is a copy of my answer from Giant IPKernelApp Error Using Hydrogen in Atom 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.
回答2:
I encontered the same issue some time ago with Jupyterlab when working locally on my machine with virtual environments.
This is a problem with Jedi being too slow (or rather taking forever) to load the completion, what worked for me was to add the follwing line at the top of the notebook (for example where you typically do the imports):
# Jedi not working
%config Completer.use_jedi = False
This should do the trick.
来源:https://stackoverflow.com/questions/65843310/completion-in-ipython-jupyter-does-now-work-unexpected-keyword-argument-colu