I am totally new to python and I have this message when I try to import bsdddb
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bsddb/__init__.py", line 67, in <module> import _bsddb ImportError: No module named _bsddb
So I followed this and this, so I downloaded this package bsddb3-4.5.0.tar.gz
. What am I suppose to do with it, I tried to run python install setup.py int the bsddb3-4.5.0 in the right directory (I am using an osx). Then I get
Can't find a local BerkeleyDB installation. (suggestion: try the --berkeley-db=/path/to/bsddb option)
Some one could help ?
bsddb is deprecated since 2.6. The ideal is to use the bsddb3 module.
My suggestion, and by far the easiest option, is to install Homebrew and use it to get BerkeleyDB on your system:
brew install berkeley-db
After this install bsddb3 using pip
pip install bsddb3
or download the source and install normally.
python setup.py install
I had a similar issue but none of the suggestions worked for me as I couldn't use AGPL license or a commercial Berkeley license from Oracle.
BERKELEYDB_DIR=$(brew --cellar)/berkeley-db/6.1.26 pip install bsddb3 Collecting bsddb3 Using cached bsddb3-6.1.1.tar.gz Complete output from command python setup.py egg_info: Trying to use the Berkeley DB you specified... Detected Berkeley DB version 6.1 from db.h ******* COMPILATION ABORTED ******* You are linking a Berkeley DB version licensed under AGPL3 or have a commercial license. AGPL3 is a strong copyleft license and derivative works must be equivalently licensed. You have two choices: 1. If your code is AGPL3 or you have a commercial Berkeley DB license from Oracle, please, define the environment variable 'YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION' to any value, and try to install this python library again. 2. In any other case, you have to link to a previous version of Berkeley DB. Remove Berlekey DB version 6.x and let this python library try to locate an older version of the Berkeley DB library in your system. Alternatively, you can define the environment variable 'BERKELEYDB_DIR', or 'BERKELEYDB_INCDIR' and 'BERKELEYDB_LIBDIR', with the path of the Berkeley DB you want to use and try to install this python library again. Sorry for the inconvenience. I am trying to protect you. More details: https://forums.oracle.com/message/11184885 http://lists.debian.org/debian-legal/2013/07/ ******* COMPILATION ABORTED *******
However reverting to an older version fixed it.
Install the older version of berkeley-db with brew
brew install berkeley-db4
Then as suggested install bsddb3 with pip
pip install bsddb3
Then
BERKELEYDB_DIR=$(brew --cellar)/berkeley-db4/4.8.30 pip install bsddb3
(modified from Stefan Schmidt's comment to reference the older berkeley-db version directory)
Finally apply patch to dbhash.py as described here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With