Installing bsddb3 6.1.1 in Windows: FileNotFoundError: 'db/include\\db.h'

Isaac picture Isaac · Nov 15, 2015 · Viewed 8.6k times · Source

I'm running Windows 7 x64, with Python 3.4. When I run pip install bsddb3 I get:

λ pip install bsddb3
Collecting bsddb3
  Using cached bsddb3-6.1.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "C:\Users\User\AppData\Local\Temp\pip-build-soqf0_qb\bsddb3\setup.py", line 42, in <module>
        import setup3
      File "C:\Users\User\AppData\Local\Temp\pip-build-soqf0_qb\bsddb3\setup3.py", line 375, in <module>
        with open(os.path.join(incdir, 'db.h'), 'r') as f :
    FileNotFoundError: [Errno 2] No such file or directory: 'db/include\\db.h'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\User\AppData\Local\Temp\pip-build-soqf0_qb\bsddb3

So I tried downloading the sources for bsddb3. I made sure I had the BSD DB Windows binaries from Oracle installed; I downloaded them from Berkeley DB 6.1.26.msi. Moving the include and lib directories from the DB install to a /db directory in the bsddb3 folder fixed the problem of not being able to find the libraries. But then the setup failed on a missing variable that's in the posix section but not properly declared in the Windows section.

Fixing that, and a couple of other adjustments, and python setup.py build actually ran the build, but after a bunch of warnings about unsafe conversions it failed with an error:

warning: I don't know what to do with 'runtime_library_dirs': ['db/lib']
error: don't know how to set runtime library search path for MSVC++

I'm not sure what to do next. Other than rewrite the library I was originally trying to use so that it uses SQLAlchemy instead or something.

Answer

cyberj0g picture cyberj0g · Dec 17, 2015

One don't really want to spend couple of nights compiling that on Windows, so the best option is to use pre-built binary from Unofficial Windows Binaries for Python Extension Packages.

Download the package for your Python version (cpXX part of the name) and architecture (win_amd64 or win32), like bsddb3-6.1.1-cp34-none-win_amd64.whl, and install it with pip:

pip install bsddb3-6.1.1-cp34-none-win_amd64.whl