TAB completion does not work in Jupyter Notebook b

2020-05-15 23:34发布

问题:

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!

回答1:

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



回答2:

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.



回答3:

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' 


回答4:

you can add

%config IPCompleter.greedy=True

in the first box of your Jupyter Notebook.



回答5:

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



回答6:

faced the same problem, for me the following worked

conda install -c anaconda jedi


回答7:

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.