Open stas00 opened 6 years ago
It's expected, although we know it's not ideal. Tab completion works by sending a message to the kernel asking for a list of completions. If the kernel is busy doing something else at the time, it doesn't reply.
Thank you for confirming the current state of things, Thomas.
Are you also saying that the design can't be changed to support a working TAB completion regardless of the state of the kernel? e.g. having a dedicated thread listening to typing activity, while having another thread doing the executions?
Thank you.
Completing from a secondary thread causes problems for some libraries that aren't expecting it - the IPython terminal interface does this at the moment, and we've had several bug reports about it. There's no easy way to fix this without redesigning how Jupyter works (edit: as far as I know).
Thank you for explaining the reason for this limitation, Thomas.
Talking about redesign, do you by chance know whether jupyterlab has this limitation resolved or is planning to?
I don't think so; it's a limitation around the way kernels work, and Jupyterlab doesn't change that.
You can get round it to a degree by doing some completion in the frontend. The notebook already has some simple frontend completion based on words you've used before in the notebook (or cell? I forget). It's tricky to do more without embedding a lot of knowledge about the kernel language, though.
In which can this be added to the feature-request list?
i.e. avail partial TAB completion functionality based on local words when the kernel is busy
Thank you!
Same
Is there a work around?
Thanks
Did you try Help-Keyboard Shortcuts, and editing automatically indent selection or auto indent? I had the same problem and just solved it.
I am having a hard time understanding the relevance of your suggestion, @HakanKiymaz - what does it have to do with indent? Which problem did you solve?
Best fix for this is using Anaconda or what ever IDE is to create a new environment. I know its a hassle to reinstall your libraries but the new environment will work with tabbing to autocomplete
My hunch is that you're referring to a different issue. I'm not sure how a different environment can make any difference if there was no change in the core of the software. Unless there was one, then please kindly indicate the change that affects this issue. Thank you.
I have an issue where tab completion doesn't work full stop. I've checked that all cells above have been run, so it should tab complete.
In a cell:
import pandas as pd
Separate cell:
pd.DataFrame
In theory, you should be able to type pd.Da + [tab] but nothing. Anyone else had a similar issue? This goes for all other methods and attributes as well. pd.DataFrame was just an example.
I have an issue where tab completion doesn't work full stop. I've checked that all cells above have been run, so it should tab complete.
In a cell:
import pandas as pd
Separate cell:
pd.DataFrame
In theory, you should be able to type pd.Da + [tab] but nothing. Anyone else had a similar issue? This goes for all other methods and attributes as well. pd.DataFrame was just an example.
I found a solution here: Quoting Ramon Martinez: "The issue can be solved by using the following magic which deactivates jedi %config Completer.use_jedi = False" This worked for me. As pointed in one comment, it seems to be a very recent issue, but I don't know what's the scenario to reproduce it. I just updated Anaconda to 1.10.0 and I have faced this problem in both Jupyter and Jupyter Lab (6.1.5 and 2.2.6, respectively) on Windows 10 Home Version 10.0.19041 Compilation19041.
On a freshly installed conda env I get this error when I try to autocomplete my imports (pressing tab when doing from pathlib import ...
)
(jupyter)~/Apps/fastexport > jupyter lab tcapelle at APY (--)(export)
[I 2021-01-25 15:03:17.500 ServerApp] jupyterlab | extension was successfully linked.
[W 2021-01-25 15:03:17.502 NotebookApp] 'password' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[I 2021-01-25 15:03:17.602 ServerApp] nbclassic | extension was successfully linked.
[I 2021-01-25 15:03:17.629 LabApp] JupyterLab extension loaded from /home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/jupyterlab
[I 2021-01-25 15:03:17.629 LabApp] JupyterLab application directory is /home/tcapelle/miniconda3/envs/jupyter/share/jupyter/lab
[I 2021-01-25 15:03:17.631 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-01-25 15:03:17.633 ServerApp] nbclassic | extension was successfully loaded.
[I 2021-01-25 15:03:17.633 ServerApp] Serving notebooks from local directory: /home/tcapelle/Apps/fastexport
[I 2021-01-25 15:03:17.633 ServerApp] Jupyter Server 1.2.2 is running at:
[I 2021-01-25 15:03:17.633 ServerApp] http://localhost:8888/lab
[I 2021-01-25 15:03:17.633 ServerApp] or http://127.0.0.1:8888/lab
[I 2021-01-25 15:03:17.633 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 2021-01-25 15:03:17.635 ServerApp] No web browser found: could not locate runnable browser.
[I 2021-01-25 15:03:20.545 ServerApp] 302 GET / (127.0.0.1) 0.48ms
[W 2021-01-25 15:03:25.350 LabApp] Could not determine jupyterlab build status without nodejs
[I 2021-01-25 15:03:26.931 ServerApp] Kernel started: cc4f68d5-23ed-43d7-9cd6-48934e11ecb6
[IPKernelApp] WARNING | Eventloop or matplotlib integration failed. Is matplotlib installed?
[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 265, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/tornado/gen.py", line 762, in run
value = future.result()
File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/tornado/gen.py", line 234, in wrapper
yielded = ctx_run(next, result)
File "/home/tcapelle/miniconda3/envs/jupyter/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/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 356, in do_complete
return self._experimental_do_complete(code, cursor_pos)
File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 381, in _experimental_do_complete
completions = list(_rectify_completions(code, raw_completions))
File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/IPython/core/completer.py", line 484, in rectify_completions
completions = list(completions)
File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/IPython/core/completer.py", line 1815, in completions
for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/IPython/core/completer.py", line 1858, in _completions
matched_text, matches, matches_origin, jedi_matches = self._complete(
File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/IPython/core/completer.py", line 2026, in _complete
completions = self._jedi_matches(
File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/IPython/core/completer.py", line 1369, in _jedi_matches
interpreter = jedi.Interpreter(
File "/home/tcapelle/miniconda3/envs/jupyter/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'
On a freshly installed conda env I get this error when I try to autocomplete my imports (pressing tab when doing
from pathlib import ...
)(jupyter)~/Apps/fastexport > jupyter lab tcapelle at APY (--)(export) [I 2021-01-25 15:03:17.500 ServerApp] jupyterlab | extension was successfully linked. [W 2021-01-25 15:03:17.502 NotebookApp] 'password' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release. [I 2021-01-25 15:03:17.602 ServerApp] nbclassic | extension was successfully linked. [I 2021-01-25 15:03:17.629 LabApp] JupyterLab extension loaded from /home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/jupyterlab [I 2021-01-25 15:03:17.629 LabApp] JupyterLab application directory is /home/tcapelle/miniconda3/envs/jupyter/share/jupyter/lab [I 2021-01-25 15:03:17.631 ServerApp] jupyterlab | extension was successfully loaded. [I 2021-01-25 15:03:17.633 ServerApp] nbclassic | extension was successfully loaded. [I 2021-01-25 15:03:17.633 ServerApp] Serving notebooks from local directory: /home/tcapelle/Apps/fastexport [I 2021-01-25 15:03:17.633 ServerApp] Jupyter Server 1.2.2 is running at: [I 2021-01-25 15:03:17.633 ServerApp] http://localhost:8888/lab [I 2021-01-25 15:03:17.633 ServerApp] or http://127.0.0.1:8888/lab [I 2021-01-25 15:03:17.633 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [W 2021-01-25 15:03:17.635 ServerApp] No web browser found: could not locate runnable browser. [I 2021-01-25 15:03:20.545 ServerApp] 302 GET / (127.0.0.1) 0.48ms [W 2021-01-25 15:03:25.350 LabApp] Could not determine jupyterlab build status without nodejs [I 2021-01-25 15:03:26.931 ServerApp] Kernel started: cc4f68d5-23ed-43d7-9cd6-48934e11ecb6 [IPKernelApp] WARNING | Eventloop or matplotlib integration failed. Is matplotlib installed? [IPKernelApp] ERROR | Exception in message handler: Traceback (most recent call last): File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 265, in dispatch_shell yield gen.maybe_future(handler(stream, idents, msg)) File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/tornado/gen.py", line 762, in run value = future.result() File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/tornado/gen.py", line 234, in wrapper yielded = ctx_run(next, result) File "/home/tcapelle/miniconda3/envs/jupyter/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/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 356, in do_complete return self._experimental_do_complete(code, cursor_pos) File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 381, in _experimental_do_complete completions = list(_rectify_completions(code, raw_completions)) File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/IPython/core/completer.py", line 484, in rectify_completions completions = list(completions) File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/IPython/core/completer.py", line 1815, in completions for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000): File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/IPython/core/completer.py", line 1858, in _completions matched_text, matches, matches_origin, jedi_matches = self._complete( File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/IPython/core/completer.py", line 2026, in _complete completions = self._jedi_matches( File "/home/tcapelle/miniconda3/envs/jupyter/lib/python3.8/site-packages/IPython/core/completer.py", line 1369, in _jedi_matches interpreter = jedi.Interpreter( File "/home/tcapelle/miniconda3/envs/jupyter/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'
Same
i knda of solved the issue downgrading jedi to 0.17.2
Normally, TAB completion works fine in jupyter notebook.
However, if there is another cell running (e.g. a long running sub-process) TAB doesn't do anything until that and any other queued for execution cells won't finish their course. It does function in other notebooks, but not in other cells of the same notebook that's "busy".
To reproduce, run this cell:
then start a new cell, and try to autocomplete (
while
):No completion happens.
This behavior slows down the development process, and in a way somewhat defeats the idea of separate cells. As one can type code, but can't do it efficiently.
Thank you.
jupyter-1.0.0, python-3.6.6 here.