"ImportError: without module named _bsddb" when opening a shelf in a Docker container

I want to open a shelve inside a Docker container in the official Python 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 main machine, the problem does not exist, and _bsddb is on /usr/lib/python2.7/lib-dynload/_bsddb.so . This file is also available in my Docker container, so I don’t understand why it cannot be imported.

Ignacio Vazquez-Abrams suggest installing db4-devel , but this package is not available in my container.

How to open a shelf in a docker container?

+5
source share
1 answer

You seem to need the libdb4.8-dev package ( link ), but unfortunately it is no longer available with Lucid.

I found several possible solutions:

  • sudo apt-get install libdb5.1++-dev ( link )
  • Install libdb4.8++ from the Lucid repository ( link )
  • sudo apt-get install libdb++-dev libminiupnpc-dev ( link , may need to reinstall Python, though)

Hope this helps!

(I'm on the train right now, so be sure to check them out for you later)


EDIT: also this page contains a lot of information about supported versions.

+1
source

Source: https://habr.com/ru/post/1212331/


All Articles