Python can't compile _curses module on Debian Lenny
Question
My Python (2.6) installation on a few servers has been compiled without curses support which I now need, although the servers have libncurses5 installed, Python did not compile the bindings for it so when I "import curses" I get:
"ImportError: No module named _curses"
my /lib/ dir has the following files and symlinks:
lrwxrwxrwx 1 root root 17 2010-02-13 05:50 /lib/libncurses.so.5 -> libncurses.so.5.7
-rw-r--r-- 1 root root 251K 2008-12-14 22:31 /lib/libncurses.so.5.7
lrwxrwxrwx 1 root root 18 2010-02-13 05:50 /lib/libncursesw.so.5 -> libncursesw.so.5.7
-rw-r--r-- 1 root root 299K 2008-12-14 22:31 /lib/libncursesw.so.5.7
and /lib64/ has:
lrwxrwxrwx 1 root root 20 2010-08-13 12:26 /lib64/libncurses.so -> /lib/libncurses.so.5
lrwxrwxrwx 1 root root 17 2010-02-13 05:50 /lib64/libncurses.so.5 -> libncurses.so.5.7
-rw-r--r-- 1 root root 251K 2008-12-14 22:31 /lib64/libncurses.so.5.7
lrwxrwxrwx 1 root root 18 2010-02-13 05:50 /lib64/libncursesw.so.5 -> libncursesw.so.5.7
-rw-r--r-- 1 root root 299K 2008-12-14 22:31 /lib64/libncursesw.so.5.7
/usr/lib64 and /usr/lib both have have :
lrwxrwxrwx 1 root root 20 2010-08-13 12:20 /usr/lib64/libncurses.so -> /lib/libncurses.so.5
When I try to 'make' python again, I get back at the end the following warning:
Failed to find the necessary bits to build these modules:
_curses_panel _tkinter bsddb185
bz2 dl gdbm
imageop readline sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Failed to build these modules:
_curses
What do I need to do to recompile Python with curses support? What am I missing here?
Thanks!
Solution 2
I'm not sure which of these actions resolved my problem but one of them did. I installed libncurses5-dev and libreadline5-dev, recompiled python and reinstalled (make / make install). Huzza
OTHER TIPS
Yes, that's right. Installing libncurses5-dev
and running 'make'
and 'make install'
on the python
installation did the trick. I had encountered the error with _curses
first while trying to install and fire up bpython
on my custom python installation.
BTW, on CentOS 6.4 64-bit, you need all of these development libraries for compiling Python 2.7.6:
yum install -y zlib-devel openssl-devel sqlite-devel bzip2-devel \
ncurses-devel readline-devel gdbm-devel db4-devel tk-devel
After yum install
those, run make
and there are four modules left:
Python build finished, but the necessary bits to build these modules were not found:
bsddb185 dl imageop sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
These are obsolete, according to this blog post:
sunaudiodev
is is for Sun platforms,dl
for 32bit platforms,imageop
is deprecated andbsddb185
is undocumented.