Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 519584 - dev-lang/python:2.7[berkdb] fails to find sys-libs/db (multilib) header files - ImportError: No module named _bsddb
Summary: dev-lang/python:2.7[berkdb] fails to find sys-libs/db (multilib) header files...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-10 20:21 UTC by Albert W. Hopkins
Modified: 2015-05-16 03:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert W. Hopkins 2014-08-10 20:21:07 UTC
For a while now I noticed that python-2.7.8[berkdb] wasn't working.

In python when you import the bsddb module you get:

Python 2.7.8 (default, Aug  7 2014, 18:57:10) 
[GCC 4.8.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
python> import bsddb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/bsddb/__init__.py", line 67, in <module>
    import _bsddb
ImportError: No module named _bsddb

I know that dev-python/bsddb3 is recommended, but I am in a virtualenv, so I decided to pip install bssdb3 in the virtualenv, but that still didn't work.  When I looked to see why the pip install was failing, I found that it's grepping for VERSION strings in db.h.  The db.h in /usr/include/db5.3 is a "multilib" version that #includes the real one inside of it.  So that's why the pip install was failing. 

So on a hunch, I thought that python-2.7.8[berkdb] must be doing something similar, so first what I did was:

# cp /usr/include/x86_64-pc-linux-gnu/db5.3/db.h /usr/include/db5.3/db.h

And then built python-2.7.8 again.  This time I was able to import the bsddb module successfully.

Looking at python-2.7.8's setup.py (at line 991), it appears to be doing nearly the same thing as bsddb3's setup.py.

So I wondered how the bsddb3 python package was working.  It has the following:

# Force version.
sed -e "s/db_ver = None/db_ver = (${DB_VER%.*}, ${DB_VER#*.})/" \
    -e "s/dblib = 'db'/dblib = '$(db_libname ${DB_VER})'/" \
    -i setup2.py setup3.py || die

So perhaps something similar needs to be done for the python package?  Although that still wouldn't work for "pip install bsddb3" I realize that might not be supportable.
Comment 1 Albert W. Hopkins 2014-08-10 20:21:28 UTC
# emerge --info
Portage 2.2.11-r1 (python 3.3.5-final-0, default/linux/amd64/13.0, gcc-4.8.3, glibc-2.19-r1, 3.16.0-gentoo x86_64)
=================================================================
System uname: Linux-3.16.0-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E3-1225_V2_@_3.20GHz-with-gentoo-2.2
KiB Mem:     3856836 total,   1264384 free
KiB Swap:    4192928 total,   4181928 free
Timestamp of tree: Sun, 10 Aug 2014 10:00:01 +0000
ld GNU ld (GNU Binutils) 2.24
app-shells/bash:          4.2_p47
dev-lang/python:          2.7.8, 3.3.5, 3.4.1
dev-util/cmake:           2.8.12.2-r1
dev-util/pkgconfig:       0.28-r2
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.69
sys-devel/automake:       1.11.6, 1.14.1
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.8.3
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2-r1
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.16 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo marduk
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA Oracle-BCLA-JavaSE AdobeFlash-11.x"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-Os -march=corei7-avx -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-Os -march=corei7-avx -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going --usepkg --binpkg-respect-use=y      --quiet-build --jobs --quiet-unmerge-warn --oneshot --autounmask=n     --nospinner --getbinpkg --buildpkg-exclude virtual/*"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news noinfo notitles parallel-fetch protect-owned sandbox sfperms skiprocheck strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="--jobs=5 --load-average=5.64"
PKGDIR="/var/portage/packages"
PORTAGE_COMPRESS=""
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/marduk"
SYNC="rsync://localhost/portage"
USE="amd64 cjk introspection nls pam systemd unicode utf8" ABI_X86="64" APACHE2_MODULES="auth_basic authz_host env include info proxy proxy_http" APACHE2_MPMS="prefork" CAMERAS="*" CURL_SSL="openssl" ELIBC="glibc" KERNEL="linux" NGINX_MODULES_HTTP="auth_basic gzip proxy referer rewrite headers_more uwsgi" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby21" USERLAND="GNU"
USE_PYTHON="2.7"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Albert W. Hopkins 2014-12-18 22:04:08 UTC
This still happens with Python 2.7.9 btw.
Comment 3 Sebastian Pipping gentoo-dev 2015-05-16 00:10:36 UTC
A fix would rock the house.
Comment 4 Mike Gilbert gentoo-dev 2015-05-16 03:00:05 UTC
Sorry, but this module is deprecated, and it seems pretty worthless to waste time on it. If you can provide a patch to make it work, that would be helpful.
Comment 5 Mike Gilbert gentoo-dev 2015-05-16 03:06:39 UTC
+  16 May 2015; Mike Gilbert <floppym@gentoo.org> package.use.mask:
+  Mask dev-lang/python[berkdb].