TAB completion does not work in Jupyter Notebook but fine in iPython terminal
Ipython NotebookReadlineJupyterTab CompletionUbuntu 15.10Ipython Notebook Problem Overview
TAB completion works fine in iPython terminal, but not in Firefox browser.
So far I had tried but failed,
1). run a command $ sudo easy_install readline
,
then the .egg file was wrote in /usr/local/lib/python2.7/dist-packages/readline-6.2.4.1-py2.7-linux-x86_64.egg,
but TAB completion still doesn't work in Jupyter Notebook.
2). also tried to find locate the ipython_notebook_config.py or ipython_config.py
, but failed.
I use Python 3.5 and iPython 4.0.0. and both are installed in Ubuntu 15.10 /usr/share/anaconda3/bin/ipython
.
Any help would be appreciated!
Ipython Notebook Solutions
Solution 1 - Ipython Notebook
It's a known issue and jedi is the problem. Try executing:
> pip3 install jedi==0.17.2
Solution 2 - Ipython Notebook
My problem was in that I try to call autocomplete and import in the same cell. Because of imported thing does not initialized yet, autocomplete does not work.
All I need is call to the object in a new cell
UPD: or just run program once in the same cell to initialize imported
Solution 3 - Ipython Notebook
I've just installed the latest JEDI then helped me to solve that issue, here's the command when using Anaconda:
conda install -c anaconda jedi
Or you might need to try this, copy this line on the top of your jupyter notebook:
%config Completer.use_jedi = False
Solution 4 - Ipython Notebook
%config Completer.use_jedi = False
This command helps but we need to add it to all the notebooks again and again.
Solution 5 - Ipython Notebook
you can add
> %config IPCompleter.greedy=True
in the first box of your Jupyter Notebook.
Solution 6 - Ipython Notebook
I had a similar issue and unfortunately cannot comment on a post, so am adding an easy solution that worked for me here. I use conda and conda list showed I was running jedi-0.18.0. I used the command conda install jedi==0.17.2. This quickly fixed the problem for my conda environment.
Additional note: I usually use jupyter-lab, and was not seeing the error messages generated. By switching to jupyter notebook, I saw the following error:
> [IPKernelApp] ERROR | Exception in message handler: Traceback (most > recent call last): File > "D:\apps\miniconda\envs\pydata-book\lib\site-packages\ipykernel\kernelbase.py", > line 265, in dispatch_shell > yield gen.maybe_future(handler(stream, idents, msg)) File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\tornado\gen.py", > line 762, in run > value = future.result() File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\tornado\gen.py", > line 234, in wrapper > yielded = ctx_run(next, result) File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\ipykernel\kernelbase.py", > line 580, in complete_request > matches = yield gen.maybe_future(self.do_complete(code, cursor_pos)) File > "D:\apps\miniconda\envs\pydata-book\lib\site-packages\ipykernel\ipkernel.py", > line 356, in do_complete > return self._experimental_do_complete(code, cursor_pos) File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\ipykernel\ipkernel.py", > line 381, in _experimental_do_complete > completions = list(_rectify_completions(code, raw_completions)) File > "D:\apps\miniconda\envs\pydata-book\lib\site-packages\IPython\core\completer.py", > line 484, in rectify_completions > completions = list(completions) File "D:\apps\miniconda\envs\pydata-book\lib\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 "D:\apps\miniconda\envs\pydata-book\lib\site-packages\IPython\core\completer.py", > line 1858, in _completions > matched_text, matches, matches_origin, jedi_matches = self._complete( File > "D:\apps\miniconda\envs\pydata-book\lib\site-packages\IPython\core\completer.py", > line 2026, in _complete > completions = self._jedi_matches( File "D:\apps\miniconda\envs\pydata-book\lib\site-packages\IPython\core\completer.py", > line 1369, in jedi_matches > interpreter = jedi.Interpreter( File "D:\apps\miniconda\envs\pydata-book\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 highlighted a couple of the jedi messages, but this all reinforced it was a problem related to the version of jedi installed.
Solution 7 - Ipython Notebook
In my case, after running pip install pyreadline
, I needed to re-execute all the lines in Jupyter before the completion worked. I kept wondering why it worked for IPython but not Jupyter.
Solution 8 - Ipython Notebook
In my case I installed miniconda on Debian Linux and most likely had a problem with the previous Python that was included with Debian. The following lines solved my problem:
conda update conda
conda update --all
The solution was taken from here based on the error that I had in IPython in terminal after writing np.<tab>
:
No such file or directory: '/home/user/miniconda3/lib/python'
Solution 9 - Ipython Notebook
The answer from Sagnik above (Dec 20, 2020) works for me on Windows 10.
pip3 install jedi==0.17.2
[Sorry I'm posting this as an answer instead of comment. I have no permission to comment yet. ]
Solution 10 - Ipython Notebook
The workaround I found is to assign the intermediate result to a temporary variable.then in seperate cell, using tab on temporary variable for auto-completion.
temp = pd.Description
temp.TAB
Solution 11 - Ipython Notebook
I had the same issue, resolved using
conda install -c anaconda jedi
Solution 12 - Ipython Notebook
I had the same issue under my conda virtual env in windows pc and downgrading the jedi to 0.17.2 version resolved the issue for me.
conda install jedi==0.17.2
Solution 13 - Ipython Notebook
faced the same problem, for me the following worked
conda install -c anaconda jedi
Solution 14 - Ipython Notebook
The best fix I've found for this issue was to create a new Environment. If you are using Anaconda simply create a new environment to fix the issue. Sure you have to reinstall some libraries but its all worth it.
Solution 15 - Ipython Notebook
F.wo.huang's comment on the OP worked for me in my anaconda environment:
condo update readline
Solution 16 - Ipython Notebook
Creating a new env variable helped me to solve this problem.
Use environments.txt
content in .conda
as path.
Solution 17 - Ipython Notebook
I had the same issue when I was using miniconda, I switched to anaconda and that seems to have solved the issue. PS. I had tried everything I could find on the net but nothing resolved it except for switching to anaconda.
Solution 18 - Ipython Notebook
As the question was asked five years ago, the answer was likely different back then... but I want to add my two cents if anyone googles today: The answer by users Sagnik and more above worked for me.
One thing to add is that if running anaconda, you can do what I did: simply
- start the anaconda-navigator software,
- locate the jedi package in my environment,
- click the little checkbox on the right of jedi
- under "Mark for specific version installation", choose 0.17.2
After restarting the kernel everything worked :)
Solution 19 - Ipython Notebook
Try the command below as discussed here
pip install -U ipython==7.20