Tab completion on IPython seems not to be working. For example,
import numpy
numpy.
simply adds a tab.
import nu
As of right now, on a OSX, pip installed ipython doesn't give tab completion, pyreadline release.py is busted .. what WFM:
easy_install ipython readline
YMMV.
pip
told me I had pyreadline version 1.7.1 installed
C:\Users\me>pip freeze | grep readline
pyreadline==1.7.1
Upgrading pyreadline
fixed it for me:
C:\Users\me>pip install --upgrade pyreadline
C:\Users\me>pip freeze | grep readline
pyreadline==2.0
Downgrading iPython did the trick.
pip install --upgrade ipython==5.8.0
Someone else in StackOverflow posted this link: http://www.vankouteren.eu/blog/2009/06/getting-ipython-readline-and-auto-completion-to-work-on-mac-os-x/
Its basicly easy_install readline
than discover where the readline egg got installed and edit the ipython bin script to use this readline:
easy_install readline
/Library/Python/site-packages/readline-*.egg
or in your Virtualenv counterpartwhich ipython
import sys
line.My virtualenved ipython bin script got working as follow:
#!/Users/alanjds/src/git/cervejeiras/venv/cervejeiras-lfs/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'ipython==0.13.1','console_scripts','ipython'
__requires__ = 'ipython==0.13.1'
import sys
### ONLY LINE ADDED:
sys.path.insert(0, '/Users/alanjds/src/git/cervejeiras/venv/cervejeiras-lfs/lib/python2.6/site-packages/readline-6.2.4.1-py2.6-macosx-10.6-fat.egg')
####
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('ipython==0.13.1', 'console_scripts', 'ipython')()
)
If you use Jupyter notebook and you still did get Tab auto-complete working after you tried all the steps suggested in the post here, you might want to check if you are trying to use the Tab auto-completion within a function definition. Ifyour import statements are part of the function such as below, you will not get the Tab auto-completion. You need to put the import statements outside the function and also execute them once before asking for auto-completion on the packages.
def myfunction():
import pandas as pd
import numpy as np
a = pd.DataFrame(np.random.normal(1,3, (4,4))
return a
Pyreadline is needed by ipython. Install pyreadline. This was done in Windows 7. Get pyreadline zip, pyreadline-master.zip, unzip. In powershell change directory into uzipped pyreadline, make sure python is set in Path, and enter commandpython setup.py install
This will intall pyreadline in C:\Python27\Lib\site-packages