Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "Failed to build these modules: _curses _curses_panel _ssl" while installing python 2.6.5

Tags:

python

ubuntu

I'm new to python and ubuntu. I'm trying to install python 2.6.5 on ubuntu 12.10. I already have python 2.7.3 and am trying to install 2.6.5 side by side the existing python. I get the following error when executing make:

Failed to find the necessary bits to build these modules:
_bsddb             bsddb185           dl
imageop            linuxaudiodev      ossaudiodev
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Failed to build these modules:
_curses            _curses_panel      _ssl

I am most worried about the _ssl module. I used ./configure --with-ssl, as mentioned in another post, but the message is still the same. Any pointers appreciated.

Additional note: make used to complain that it could not build bz2 either, but I fixed that with this post entry recompiling bzip2. Now it's down to _ssl. I'm not sure if I need _curses.

Edit: Found make log file and it looks like this is due to the fact that python 2.6.5 supports ssl v2, while this support was removed in Ubuntu. Log file contains:

*** WARNING: renaming "_ssl" since importing it failed: build/lib.linux-x86_64-2./_ssl.so: undefined symbol: SSLv2_method

This blog has python 2.6.8 rebuilt without the ssl v2 support. I'm trying their changes in the 2.6.5 source now.

Edit 2: Modifying 2.6.5 sources as noted above and removing ssl v2 support fixed the problem with _ssl module not building. Also, here is a list of packages I tried installing earlier:

apt-get install libreadline-dev
apt-get install libssl-dev (already installed)
apt-get install libbz2-dev (already installed)
apt-get install build-essential (already installed)
apt-get install sqlite3
apt-get install tk-dev
apt-get install libsqlite3-dev
apt-get install libc6-dev (already installed)
apt-get install libgdbm-dev
apt-get install libncursesw5-dev

Here is full output from make:

running build
running build_ext
building '_curses' extension
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict prototypes -I. -I/tmp/nimbula/Python-2.6.5/./Include -I. -IInclude -I./Include -I/usr/local/include -I/tmp/nimbula/Python-2.6.5/Include -I/tmp/nimbula/Python-2.6.5 -c /tmp/nimbula/Python-2.6.5/Modules/_cursesmodule.c -o build/temp.linux-x86_64-2.6/tmp/nimbula/Python-2.6.5/Modules/_cursesmodule.o
building '_curses_panel' extension
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -I/tmp/nimbula/Python-2.6.5/./Include -I. -IInclude -I./Include -I/usr/local/include -I/tmp/nimbula/Python-2.6.5/Include -I/tmp/nimbula/Python-2.6.5 -c /tmp/nimbula/Python-2.6.5/Modules/_curses_panel.c -o build/temp.linux-x86_64-2.6/tmp/nimbula/Python-2.6.5/Modules/_curses_panel.o

Failed to find the necessary bits to build these modules:
_bsddb             bsddb185           dl
imageop            linuxaudiodev      ossaudiodev
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Failed to build these modules:
_curses            _curses_panel

running build_scripts

Edit 3: Yay, thank you guys for asking these questions. When I looked at the packages I installed earlier, one was clearly not looking good, the libncursesw5-dev (since it has a version in it and I got it from an old post). I tried the following and it solved the problem of _curses and _curses_panel not building:

apt-get install libncurses-dev

After installing libncurses-dev, I executed: make clean, ./configure --with-ssl, make.

Now the output from make is:

running build
running build_ext

Failed to find the necessary bits to build these modules:
_bsddb             bsddb185           dl
imageop            linuxaudiodev      ossaudiodev
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

running build_scripts
like image 899
Lidia Avatar asked Oct 02 '13 23:10

Lidia


2 Answers

Here is how I resolved pythong 2.6.5 installation on ubuntu 12.10:

1.) I tried to install the following libraries (some were already on the system):

apt-get install libreadline-dev
apt-get install libssl-dev (already installed)
apt-get install libbz2-dev (already installed)
apt-get install build-essential (already installed)
apt-get install sqlite3
apt-get install tk-dev
apt-get install libsqlite3-dev
apt-get install libc6-dev (already installed)
apt-get install libgdbm-dev
apt-get install libncurses-dev

2.) Issue with bz2 module not building:

a.) I downloaded bz2 source from http://www.bzip.org/downloads.html. b.) Modified Makefile and changed cc=gcc to 'cc=gcc -fPIC` following this post. c.) Executed make and make install. d.) Tested bz2 with the following code from command line: python -c "import bz2; print bz2.doc"

3.) Issue with _ssl module not building:

a.) Fixed ssl by removing ssl v2 from python source. Followed instructions in this blog by Michael Schurter. It worked like a charm.

4.) At this point I installed Python 2.6.5 using make altinstall, as to not overwrite the existing python. I pointed /usr/bin/python to my new python installation. Still a couple of things were missing.

5.) Added ez_setup: curl -O https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py python ez_setup.py

6.) Added pip: easy_install -U pip

7.) Installed setuptools: pip install setuptools

At this point it looks like it's all working!

like image 136
Lidia Avatar answered Oct 24 '22 02:10

Lidia


You haven't given us enough information to actually know what happened; build output and build logs exist for a reason…

But I can guess with about 80% confidence:

You don't have the right headers installed to build them.

For example, if you've installed the dpkg for libssl but not for libssl-dev, you won't be able to build _ssl. On Ubuntu, just sudo apt-get install libssl-dev and fix that. On different distros, it may be something like libssl-devel, ssl-dev, etc. But the basic concept of development pacakages is the same everywhere: to run a program that requires foo, you only need the foo package, but to build a program that requires foo, you need the foo development package as well.

For some of these libraries, it's not quite as obvious which package you're missing, but you should still be able to tell the name of the library or header file it couldn't find by looking at the logs, and you can search, or ask on an Ubuntu forum, to find out which package provides that missing file.

like image 24
abarnert Avatar answered Oct 24 '22 02:10

abarnert