F.wo.huang
F.wo.huang

Reputation: 739

TAB completion does not work in Jupyter Notebook but fine in iPython terminal

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!

Upvotes: 72

Views: 109503

Answers (20)

Buck Dharma II
Buck Dharma II

Reputation: 1

I updated Jupyter Notebook to version 7. Everything works now.

Upvotes: 0

SantoshB
SantoshB

Reputation: 11

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

Upvotes: 1

Deepa
Deepa

Reputation: 27

I had the same issue, resolved using

conda install -c anaconda jedi

Upvotes: 2

masoud
masoud

Reputation: 534

Try the command below as discussed here

pip install -U ipython==7.20

Upvotes: 0

Johan
Johan

Reputation: 1

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

Upvotes: 0

T I M
T I M

Reputation: 85

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.

Upvotes: 6

semicolon
semicolon

Reputation: 338

%config Completer.use_jedi = False

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

Upvotes: 24

bob chen
bob chen

Reputation: 57

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

Upvotes: 3

Amibest
Amibest

Reputation: 687

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

Upvotes: 26

Sagnik
Sagnik

Reputation: 1456

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

Upvotes: 125

Ali Muhammad
Ali Muhammad

Reputation: 1

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.

Upvotes: 0

vijay krishna
vijay krishna

Reputation: 1

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

Use environments.txt content in .conda as path.

Upvotes: 0

lili
lili

Reputation: 11

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

condo update readline

Upvotes: 0

berkat0789
berkat0789

Reputation: 65

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.

Upvotes: 0

agarg
agarg

Reputation: 418

faced the same problem, for me the following worked

conda install -c anaconda jedi

Upvotes: 0

Ashish Anand
Ashish Anand

Reputation: 2743

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

Upvotes: 2

ruedi
ruedi

Reputation: 5545

you can add

%config IPCompleter.greedy=True

in the first box of your Jupyter Notebook.

Upvotes: 13

keiv.fly
keiv.fly

Reputation: 4015

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' 

Upvotes: 4

M.abr
M.abr

Reputation: 61

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.

Upvotes: 4

shurik2533
shurik2533

Reputation: 1780

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

Upvotes: 40

Related Questions