bsddb in python 2.5.1

BjornT bjorn.tipling at
Sun Nov 4 21:36:40 CET 2007

On Nov 4, 1:04 am, "Martin v. Löwis" <mar... at> wrote:
> > I know that when you upgrade Berkeley DB you're supposed to go through
> > steps solving this problem,but I wasn't expecting an upgrade. I've
> > tried to use different versions bsddb3, 4.4 and 4.5, (instead of bsddb
> > that comes with python 2.5.1) with different versions of Berkeley DB
> > installs (4.5 and 4.4 - built from source into /usr/local).
> There seems to be an important misconception here. Python 2.5.1 does
> not come with any bsddb version whatsoever. If you have a Python binary
> where the bsddb module is linked with a certain version of Python, that
> was the choice of whoever made the Python binary.
> For acccess to the database, the Python version does not matter at all.
> What matters is the version of Berkeley DB.
> So as the first step, you should find out what version of Berkeley DB
> the old Python installation was using, and what version of Berkeley DB
> the new version is using.
> I'm also not sure what you mean by "I've tried to use different version
> bsddb3, 4.4 and 4.5". What specifically did you do to try them? AFAICT,
> Ubuntu "Feisty Fawn" linked its Python with bsddb 4.4, so you should
> have no version issues if you really managed to use bsddb 4.4.
> Can you please report the specific error you got? According to the
> Berkeley DB documentation, there was no change to database formats
> in Berkeley DB 4.5 (but there was a change to the log file format).
> Regards,
> Martin


Thank you for your reply. My exact error (when I use bsddb that came
with Ubuntu's python 2.5.1) is as follows:

2007-11-04 13:23:05: (mod_fastcgi.c.2588) FastCGI-stderr: Traceback
(most recent call last):
  File "/usr/lib/python2.5/site-packages/web/", line 304, in
    result = func()
  File "/usr/lib/python2.5/site-packages/web/", line 129, in
    func = lambda: handle(getattr(mod, name), mod)
  File "/usr/lib/python2.5/site-packages/web/", line 61, in
    return tocall(*([x and urllib.unquote(x) for x in args] + fna))
  File "/home/bjorn/karmerd-svn/", line 6, in GET
    self.handleRequest("GET", path)
  File "/home/bjorn/karmerd-svn/", line 14, in handleRequest
    request_api = api.Api(path, input, web.ctx, type)
  File "/home/bjorn/karmerd-svn/", line 14, in __init__
    self.a = kapilib.abuse.Abuse(input, identity, self.pathParts[1],
  File "/home/bjorn/karmerd-svn/kapilib/", line 26, in
    d.addEntry(identity.ip,, time.time())
  File "/home/bjorn/karmerd-svn/dal/", line 11, in addEntry
    env = dal.dalbase.Dal._getOpenEnv(self)
  File "/home/bjorn/karmerd-svn/dal/", line 94, in
_getOpenEnv, flags)
DBError: (-30972, "DB_VERSION_MISMATCH: Database environment version
mismatch -- Program version 4.5 doesn't match environment version

As I have said I have two versions of Berkeley DB installed in /usr/

drwxr-xr-x  6 root root 4096 2007-11-03 13:51 BerkeleyDB.4.4
drwxr-xr-x  6 root root 4096 2007-06-09 14:04 BerkeleyDB.4.5

I have two versions of bsddb3 installed (only one is active) this is
from /usr/lib/python2.5/site-packages:
drwxr-xr-x  3 root root   4096 2007-11-03 15:01 bsddb3
-rw-r--r--  1 root root    905 2007-11-03 15:39 bsddb3-4.4.2.egg-info
-rw-r--r--  1 root root    905 2007-11-03 15:49 bsddb3-4.5.0.egg-info

 And of course I have this, which was just in Python 2.5 as it came in
drwxr-xr-x  2 root root   4096 2007-11-02 19:32 bsddb

As per:

"> Ubuntu "Feisty Fawn" linked its Python with bsddb 4.4, so you
> have no version issues if you really managed to use bsddb 4.4."

I tried to use bsddb3, which I downloaded from sourceforge to link to
the different versions of berkeley db I have, but trying to open the
database just stalls, there's never a response. In the interactive
interpreter, I never get the prompt back, I have to kill they python
process. I'm really at a loss of what I could do, except for reverting
back to Ubuntu 7.05. In the future I plan on not using what ships with
the OS, but from source or binaries that I install so I can have
control over the update process.

More information about the Python-list mailing list