I want to open a shelve inside a Docker container based in Python's official image, python:2.7.9-wheezy. But I get an import error.
syncer/util.py:19: in get_from_shelve
db = shelve.open(conf.SHELVE_LOCATION)
/usr/local/lib/python2.7/shelve.py:239: in open
return DbfilenameShelf(filename, flag, protocol, writeback)
/usr/local/lib/python2.7/shelve.py:223: in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
/usr/local/lib/python2.7/anydbm.py:84: in open
mod = __import__(result)
/usr/local/lib/python2.7/dbhash.py:7: in <module>
import bsddb
...
E ImportError: No module named _bsddb
On my host machine the problem isn't there and _bsddb is located at
/usr/lib/python2.7/lib-dynload/_bsddb.so. This file is also available in my Docker container, so I don't understand why it can't be imported.
Ignacio Vazquez-Abrams suggest to install db4-devel, but this package isn't available in my container.
How do I open the shelve in the Docker container?
It seems like you need the
libdb4.8-devpackage (link), but unfortunately this is no longer available since Lucid.I have found some possible solutions:
sudo apt-get install libdb5.1++-dev(link)libdb4.8++from the Lucid repository (link)sudo apt-get install libdb++-dev libminiupnpc-dev(link, might require reinstalling Python though)Hope it helps!
(I'm on the train right now, so will definitely test them for you later)
EDIT: Also this page gives a lot of information about supported versions.