93

I am very new to this and don't know why the autocomplete is not working. I tried modifying the iPython config file, installed readline, but still nothing.

snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
user2822693
  • 1,300
  • 2
  • 10
  • 15
  • 4
    What have you tried, what do you see? Completions should show up when you type some code and press tab. – Thomas K Nov 10 '16 at 22:14

11 Answers11

261

A possible reason a user may believe that autocomplete is not working may be that autocomplete is just taking too long. Circa 2020-11-27 this is particularly true for Pandas when operating with jedi in a Jupyter notebook environment.

The issue can be solved by using the following magic which deactivates jedi

%config Completer.use_jedi = False

For a deeper discussion follow the this thread and the links therein.

Eric O. Lebigot
  • 91,433
  • 48
  • 218
  • 260
Heberto Mayorquin
  • 10,605
  • 8
  • 42
  • 46
  • 8
    To make the change permanent locate your profile directory `ipython locate` and edit the relevant entry for `Completer.use_jedi` in the `ipython_config.py`. – Christian Herenz Apr 12 '21 at 21:24
  • 4
    It works for me. By the way, if it is the first time to edit the config file, you need first create it using: `ipython profile create`, see https://ipython.readthedocs.io/en/stable/config/intro.html for detail. – xmfbit Oct 20 '21 at 13:47
36

the current Ipython with the Jupyter notebook doesn't require jedi.. So you have to just uninstall it with the following command.

pip uninstall jedi --yes
Paulo Mendonça
  • 635
  • 12
  • 28
Harish Panwar
  • 461
  • 4
  • 2
  • 1
    Interesting, but uninstalling jedi didn't remove the problem, the %config command is still needed. – Artem Trunov Mar 22 '21 at 14:48
  • Worked for me in a SageMaker Studio Notebook – hygorxaraujo May 07 '21 at 18:26
  • uninstalling jedi worked for me. (%config worked too). – Keerthi Bandara Jun 08 '21 at 19:56
  • This did absolutely nothing to solve the problem for me on Mac, JupyterLab. I'd say basically every answer to this question that doesn't involve the config change is useless and incidental. – JPKab Jun 23 '21 at 18:34
  • Didn't work for me. By uninstalling jedi in particular environment I got `AttributeError: module 'jedi' has no attribute 'settings'` error in kernel. Updating `ipython_config.py` worked and `%config Completer.use_jedi = False` also worked – Ernest Jul 14 '21 at 06:52
16

Seems like installing a specific version of jedi worked for me:

!pip install --upgrade jedi==0.17.2
Oren Yosifon
  • 897
  • 8
  • 22
  • This did the trick for me, i had jedi v. 0.17.0 and upgrading it re-enabled autocomplete. – wtfzambo Apr 29 '21 at 10:38
  • For me too (Ipython 7.22, had jedi 0.17.0) – jpmuc May 14 '21 at 15:10
  • This didn't work at all for me when trying today for JupyterLab. I'm not sure why this has been allowed to go on for so long. I'm trying to teach Jupyter to several colleagues, and autocomplete being broken is a big UX fail. – JPKab Jun 23 '21 at 18:31
  • 2
    For anyone arriving here with an "older" version of ipython, there was a bug with the Jedi dependency, (0.18.0 doesn't work, 0.17.2 does). https://github.com/ipython/ipython/issues/12740 – Troy Nov 07 '21 at 13:22
5

Installing:

C:> pip install pyreadline

works fine, as it was suggested in an older post

Sebastián Palma
  • 32,692
  • 6
  • 40
  • 59
user2822693
  • 1,300
  • 2
  • 10
  • 15
3

If you are using jedi=0.18 with ipython=7.19 try this in your environment:

pip install -U ipython==7.20

see this github discussion.

masoud
  • 535
  • 3
  • 16
3

install jupyter contrib nbextensions by running

pip install jupyter_contrib_nbextensions

Next install js and css file for jupyter by running

jupyter contrib nbextension install --user

and at the end run,

jupyter nbextension enable hinterland/hinterland

The output of last command will be

Enabling notebook extension hinterland/hinterland...
      - Validating: OK

I refer from this: How to get autocomplete in jupyter notebook without using tab?

cng.buff
  • 405
  • 4
  • 5
2

Ipython 6+ now has jedi integration built in.

update Ipython, and install jedi:

pip install ipython --upgrade
pip install jedi

If you are using Anaconda / conda:

$> conda update jupyter --update-dependencies
$> conda install jedi
Lundy
  • 663
  • 5
  • 19
1

just below the Python logo there is a button saying

not trusted

click on it and set it as trusted notebook.

Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
1

I use JupyterLab 3.0.6. I have ipython 7.19.0 and jedi 0.18 installed. As @DaveHalter indicated, better than <% config Completer.use_jedi = False> is to use the previous version of the jedi <pip install jedi == 0.17.2>. In 2021-01-31 it worked perfectly for me.

  • 1
    I have installed JupyterLab 3.0.6. and just change/installed jedi version. Now, it's a working for me ! Thanks. ``pip3 install jedi == 0.17.2 `` – shivang patel Feb 02 '21 at 12:06
0

If you tried to install tabnine with the juptyerlab extension manager, type in

pip uninstall jupyterlab_tabnine

in a shell. When you still get the problem, delete the folder

%appdata%\Python\share\jupyter\labextensions\@tabnine\

this worked for me

GuiTaek
  • 398
  • 2
  • 12
0

it worked for me

!pip install jedi --upgrade

first write => !pip install jedi --upgrade then for test, you can write import pandas as pd after write pd. and then hit tab

Mahsaa M
  • 11
  • 1