Disclaimer: Although I’m a python developer, I’m not someone who has built libraries from source. I already posted gist
about this same issue, but I’ve now used it three times so I wanted to re-post on my blog.
Intro
If you’re running Linux, you may have installed anaconda to replace your package management needs, and loved it. Except when you fire up iPython you get an annoying “extra space” for your tab completion… that hasn’t been patched yet.
When looking here and here, it appears to still be an issue.
With some hand-holding of @cpcloud (as in, “he held mine”), he was able to fix that problem for me today with very little effort.
Step 1
Make sure you have libreadline-dev
installed on you Linux box a la:
$ sudo apt-get install libreadline-dev
Step 2
Download and build Python 2.7.8 from source. Can also be found @cpcloud’s gist:
$ wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
$ tar xvf Python-2.7.8.tar.xz
Step 3
Compile & Make the Install
This portion comes for @kbg ‘s post about this very issue
$ cd Python-2.7.8
$ ./configure --enable-shared --enable-ipv6 --enable-unicode=ucs4 --prefix=/usr
$ make -j `nproc`
Step 4
Copy the compiled libreadline.so
object into your ../anaconda/lib/python2.7/lib-dynload/
folder.
#Find where `readline.so` is located
$ find -name 'readline.so'
#came back ./build/lib.linux-x86_64-2.7/readline.so
$ cp ./build/lib.linux-x86_64-2.7/readline.so ~/anaconda/lib/python2.7/lib-dynload/
Step 5
Remove the conda readline install
$ conda remove readline
Step 6
Check to make sure it worked
Close and re-open iPython, and try your tab completion (worked for me).