Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 215
Isaac Avatar asked Nov 14 '15 23:11

Isaac


2 Answers

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
like image 129
cyberj0g Avatar answered Oct 17 '22 08:10

cyberj0g


Based on cyberj0g's answer. https://www.lfd.uci.edu/~gohlke/pythonlibs/#bsddb3

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

Note: the cp part is corresponding to the CPython version.

which means cp36 is for CPython 3.6.And divided into 32-bit and 64-bit versions for windows

  • bsddb3‑6.2.5‑cp36‑cp36m‑win32.whl
  • bsddb3‑6.2.5‑cp36‑cp36m‑win_amd64.whl
like image 39
K.Andy Wang Avatar answered Oct 17 '22 10:10

K.Andy Wang