25

I just installed a few libraries for deep learning like keras, theano etc. The installation went fine but when I write code in Jupyter Notebook and press tab for autocompletion, the kernel of Jupyter Notebook seems to take too long for autocompletion. There have been times when it has taken minutes to display autocompleted options. I initially thought that the kernel hung so I had to restart it every time.

I read in another Stack Overflow post that installing pyreadline may help. I installed it but I'm still having the same problem.

Has anyone else faced this problem? How do I go about fixing this?

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Patthebug
  • 4,647
  • 11
  • 50
  • 91

2 Answers2

76

You might try this at the top of your notebook:

%config Completer.use_jedi = False
wjandrea
  • 28,235
  • 9
  • 60
  • 81
Miles
  • 1,104
  • 11
  • 13
  • The solution looks very strange, but it really solved the problem and stopped consuming a lot of my RAM and killing the kernel! – lucidyan Sep 16 '17 at 14:34
  • 4
    To get a bit more context on this solution, refer to https://github.com/ipython/ipython/issues/10493 and https://github.com/davidhalter/jedi/issues/931 where this solution is discussed. – Zertrin Dec 18 '17 at 04:19
  • 2
    Is there a way to put this in some config file so that I don't have to add this to every single notebook I create? – vkkodali Apr 05 '19 at 17:38
  • 9
    @Kayvee You can add `c.Completer.use_jedi = True` to an `ipython_config.py` file. https://ipython.readthedocs.io/en/stable/development/config.html – Miles Apr 06 '19 at 13:56
  • 1
    it doesn't work for me - Name of pandas dataframes take lot of time for auto complete.. dont know the reason. Any ideas how to debug? – rishi jain Jun 11 '20 at 12:50
0

Jedi is the culprit. Either you can disable it as suggested by @Miles above,
or remove it completely.

pip uninstall jedi

Uninstallig worked for me. Jupyter suggestions are much faster now!

Vishal R
  • 1,279
  • 1
  • 21
  • 27
  • 2
    Don't do this. It messed up my Jupyter notebook kernels. Use either inline `%config Completer.use_jedi = False` or set `c.Completer.use_jedi = True` in `ipython_config.py` – Ernest Aug 04 '21 at 14:33
  • I did not face any issue. how did it mess up? – Vishal R Aug 04 '21 at 15:03
  • It wouldn't load the kernel and show in terminal that it can't find jedi package. – Ernest Aug 09 '21 at 11:14