43

I installed ipython but it doesn't have the readline option. I first downloaded gnu readline and compiled and installed. DIdn't know whether it was a proper solution but was the first thing I thought of. It still wouldn't work to no avail with the same error as before:

WARNING: Readline services not available on this platform.
WARNING: The auto-indent feature requires the readline library

Then I tried using pip install readline and I get the error below. Any help would be appreciated:

running install

running build

running build_ext

building 'readline' extension

creating build

creating build/temp.linux-x86_64-2.6

creating build/temp.linux-x86_64-2.6/Modules

creating build/temp.linux-x86_64-2.6/Modules/2.x

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_RL_CALLBACK -DHAVE_RL_CATCH_SIGNAL -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_COMPLETION_SUPPRESS_APPEND -DHAVE_RL_PRE_INPUT_HOOK -I. -I/home/jspender/include/python2.6 -c Modules/2.x/readline.c -o build/temp.linux-x86_64-2.6/Modules/2.x/readline.o -Wno-strict-prototypes

creating build/lib.linux-x86_64-2.6

gcc -pthread -shared build/temp.linux-x86_64-2.6/Modules/2.x/readline.o readline/libreadline.a readline/libhistory.a -L/home/jspender/lib -lncurses -lpython2.6 -o build/lib.linux-x86_64-2.6/readline.so

/usr/bin/ld: cannot find -lncurses

collect2: ld returned 1 exit status

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /home/jspender/bin/python2.6 -c "import setuptools;__file__='/home/jspender/build/readline/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-lBWIOm-record/install-record.txt failed with error code 1
Storing complete log in /home/jspender/.pip/pip.log
ptomato
  • 56,175
  • 13
  • 112
  • 165
J Spen
  • 2,614
  • 4
  • 26
  • 41
  • If you're on Linux, you shouldn't need to compile it, your distribution repositories should have readline. On Ubuntu, it's libreadline6 or libreadline5. It's normally installed by default, though. – Thomas K Jul 08 '11 at 11:43

3 Answers3

75

tmaric is right. I had the same problem while installing iPython (Ubuntu 12.10, quantal, 32-bit). I was missing the dev version of the ncurses5 library. Try:

sudo apt-get install libncurses5-dev

and then installing the readline module again through pip

pip install readline
Community
  • 1
  • 1
PythonJin
  • 4,034
  • 4
  • 32
  • 40
  • Ubuntu should have readline preinstalled, though. It does for me. – Thomas K Jan 04 '13 at 20:52
  • Yeah, I'm not sure if it has something to do with the fact that I'm using pythonbrew and a virtual environment to install IPython in. – PythonJin Jan 05 '13 at 15:35
  • 1
    Pythonbrew would probably be it - if you don't have the relevant header files when you compile Python, it will skip bits like readline support. You could try `sudo apt-get build-dep python` before you compile it. – Thomas K Jan 05 '13 at 22:58
  • 5
    The incantation on my machine was `$ sudo yum install ncurses-devel` followed by `$ sudo pip install readline` – MarkHu Mar 01 '13 at 00:38
3

You have a linker error: library ncurses is not installed, or it is installed and the linker is searching for the wrong object file.

What platform/operating system are you using?

If you're running Linux/Unix, try:

locate libncurses

to see if the library is installed. If there are no libncurses*.{o,so,so.[0-9].[0-9]} files on your system, just install the library, and the readline. If there are some, then check which one is searched for by the readline compilation process, it could be that you just have to make a symbolic link, naming the library file properly.

tmaric
  • 5,347
  • 4
  • 42
  • 75
2

I had the same issue with my Ubuntu 14.04 install trying to get some python libraries installed. iPython I believe requires readline which was failing for me until I ran the following commands.

sudo apt-get install python-dev
sudo apt-get install libncurses5-dev
sudo pip install readline
Jiveman
  • 21
  • 2