pythonpiplmdb

Why am I not able to install lmdb using pip?


I'm following the turorial found here: https://realpython.com/storing-images-in-python/.

The first few steps in the tutorial work well; however, when I get to the step

$ pip install lmdb

I get more than 100 errors, and the installer gives up. I'm wondering how to correct this problem.

My entry of the step shown above looks like this in the Pycharm terminal:

(venv) C:\Users\User\PycharmProjects\OpenCVExamples>pip install lmdb

After entering the pip command shown above, I see the following on the screen:

Collecting lmdb
Using cached https://files.pythonhosted.org/packages/86/5
/6ad690daeaa00b328606bf2fa435244a11cc2dd9aedac6ef4d2ef2a21f6e/lmdb
0.96.tar.gz
Installing collected packages: lmdb
Running setup.py install for lmdb ... error

Then I get a dump showing the following steps that were taken:

py-lmdb: Using bundled liblmdb; override with LMDB_FORCE_SYSTEM=1.
py-lmdb: Using CPython extension; override with LMDB_FORCE_CFFI=1.
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\lmdb
copying lmdb\cffi.py -> build\lib.win32-3.7\lmdb
copying lmdb\tool.py -> build\lib.win32-3.7\lmdb
copying lmdb\_config.py -> build\lib.win32-3.7\lmdb
copying lmdb\__init__.py -> build\lib.win32-3.7\lmdb
copying lmdb\__main__.py -> build\lib.win32-3.7\lmdb
running build_ext
building 'cpython' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\lmdb
creating build\temp.win32-3.7\Release\lib

Next, I get a few warnings then a list of more than 100 errors. The warnings and the first few errors are shown below:

cl : Command line warning D9025 : overriding '/DNDEBUG' with '/UNDEBUG'
cl : Command line warning D9025 : overriding '/W3' with '/w'
error C2146: syntax error: missing ')' before identifier 'uintptr_t'
error C2059: syntax error: ')'
error C2085: '_StackCookie': not in formal parameter list

Finally, I get an error at the end a red font. The final error is:

Command "C:\Users\User\PycharmProjects\OpenCVExamples\venv\Script
\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Use
\\AppData\\Local\\Temp\\pip-install-227nwnf7\\lmdd
\\setup.py';f=getattr(tokenize, 'open',
open)(__file__);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record
C:\Users\User\AppData\Local\Te
mp\pip-record-a9unp95q\install-record.txt --single-version-externally
managed --compile --install-headers C:\Users\User\PycharmProject
\OpenCVExamples\venv\include\site\python3.7\lmdb" fai
led with error code 1 in C:\Users\User\AppData\Local\Temp\pip-install
227nwnf7\lmdb\

Solution

  • Since nobody has entered an official answer after 2.5 years, I decided to copy the answer given above in the comments by furas:

    It seems there is error in C/C++ code. So you can write to author or you may try to use Anaconda which should have precompiled module LMDB and it doesn't use C/C++ compiler. You can also check on Unofficial Windows Binaries for Python Extension Packages