71

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!

PravinS
  • 2,640
  • 3
  • 21
  • 25
F.wo.huang
  • 729
  • 1
  • 6
  • 4
  • 1
    FYI, in my case, run the command $ conda update readline, and now the TAB completion works fine in Jupyter Notebook. But still I don't know why. – F.wo.huang Nov 12 '15 at 19:38

19 Answers19

125

It's a known issue and jedi is the problem. Try executing:

pip3 install jedi==0.17.2

https://github.com/jupyter/notebook/issues/2435

Sagnik
  • 1,446
  • 1
  • 9
  • 13
  • 17
    this is a good answer that worked for me (ubuntu 20.04, pyhton3.8). I had jedi version 0.18. After installing the 0.17.2 version all tab completion problems were gone. – B.Kocis Jan 03 '21 at 14:22
  • 2
    Had to re-run all code (">>") before it took effect. – langlauf.io Jan 04 '21 at 11:34
  • 2
    I was running jupyter lab on windows, and this fixed my tab completion problem – trianta2 Jan 20 '21 at 20:40
  • Running JupyterLab on MacOS 10.14.6, Python 3.8.1. Worked for me! – Kristen G. Jan 28 '21 at 21:00
  • 1
    You can upgrade iPython instead. Refer to [python - Completion in IPython (jupyter) does now work (unexpected keyword argument 'column') - Stack Overflow](https://stackoverflow.com/questions/65843310/completion-in-ipython-jupyter-does-now-work-unexpected-keyword-argument-colu/65862512#65862512) – user202729 Feb 03 '21 at 14:22
  • This is not a good answer anymore. Pinning to an outdated version one year after release of compatible IPython version will only make your environment more susceptible to old bugs and security concerns patched in later versions. Instead you should upgrade IPython. – krassowski Oct 11 '21 at 13:29
40

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 enter image description here

UPD: or just run program once in the same cell to initialize imported

shurik2533
  • 1,770
  • 4
  • 22
  • 41
26

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
Amibest
  • 687
  • 7
  • 6
24
%config Completer.use_jedi = False

This command helps but we need to add it to all the notebooks again and again.

semicolon
  • 338
  • 2
  • 7
  • 2
    Hello and welcome to SO! It is already part of another answer: https://stackoverflow.com/a/65647689/2359227 If you nothing to elaborate please consider upvoting the other answer and delete yours. Please read the [tour](https://stackoverflow.com/tour), and [How do I write a good answer?](https://stackoverflow.com/help/how-to-answer) – Tomer Shetah Jan 10 '21 at 09:06
  • I dont have reputation to comment, how to earn reputation ? – semicolon Jan 10 '21 at 10:36
  • [What is reputation? How do I earn (and lose) it?](https://stackoverflow.com/help/whats-reputation) – Tomer Shetah Jan 10 '21 at 10:38
  • ipython profile create, you can use this command to generate a config file in /Users/zhivarsourati (my root directory )/.ipython/profile_default – Zhivar Sourati Jan 20 '21 at 10:02
13

you can add

%config IPCompleter.greedy=True

in the first box of your Jupyter Notebook.

ruedi
  • 5,365
  • 15
  • 52
  • 88
6

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.

T I M
  • 83
  • 1
  • 6
  • 1
    I too ran into this issue. One note when using nb_conda_kernels: I had to downgrade jedi to 0.17.2 in the same environment as my ipykernel and not the one in which I have jupyterlab installed. – Will Jan 28 '21 at 18:17
4

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.

Peter Clotworthy
  • 144
  • 3
  • 13
M.abr
  • 61
  • 3
4

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' 
keiv.fly
  • 3,343
  • 4
  • 26
  • 45
3

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. ]

bob chen
  • 57
  • 3
2

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

enter image description here

Ashish Anand
  • 2,575
  • 23
  • 15
2

I had the same issue, resolved using

conda install -c anaconda jedi
STA
  • 30,729
  • 8
  • 45
  • 59
Deepa
  • 27
  • 4
1

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

SantoshB
  • 11
  • 1
0

faced the same problem, for me the following worked

conda install -c anaconda jedi
agarg
  • 318
  • 3
  • 11
0

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.

berkat0789
  • 51
  • 3
0

F.wo.huang's comment on the OP worked for me in my anaconda environment:

condo update readline
lili
  • 11
  • 3
0

Creating a new env variable helped me to solve this problem.

Use environments.txt content in .conda as path.

Greenonline
  • 1,330
  • 8
  • 23
  • 31
0

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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
0

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 :)

Johan
  • 1
  • 1
0

Try the command below as discussed here

pip install -U ipython==7.20

masoud
  • 535
  • 3
  • 16