Closed automorphis closed 2 years ago
After reading the py-lmdb docs, I realize I forgot to pip install cffi
. After I did that, however, I get the following error when I try to open
a new Environment
:
>>> import lmdb
>>> from pathlib import Path
>>> test = str(Path.home() / "test")
>>> db = lmdb.open(test)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sage/py-lmdb/lmdb/cffi.py", line 776, in __init__
raise _error(path, rc)
lmdb.cffi.InvalidParameterError: b'/home/sage/test': b'Invalid argument'
>>> Path("/home/sage/test").is_dir()
True
I did some more troubleshooting/research and I've localized the problem to a line in mdb.c (github.com). I am getting the error EINVAL
from pthread_mutexattr_setpshared
.
That's a limitation of cygwin. See https://www.mail-archive.com/cygwin@cygwin.com/msg167155.html
Thank you! For what it's worth, I added the line
extra_compile_args += ['-DMDB_USE_POSIX_SEM']
to setup.py
of py-lmdb
and it seemed to resolve the issue. I only tested Transaction.get
and .put
, though. I'm fairly ignorant of mutex and semaphores.
Edited to add: The next day, I was not able to get get
to work. put
returned True
, but get
would throw MDB_CORRUPTED
. I localized the error to this line in cmd.c
. I don't know why it worked before and why it doesn't work now. I am just going to use WSL2 and leave Cygwin behind.
Affected Operating Systems
Affected py-lmdb Version
1.2.1
py-lmdb Installation Method
Using bundled or distribution-provided LMDB library?
Bundled
Describe Your Problem
py-lmdb fails to install on Cygwin. I did some research and it seems this is because Cygwin does not support the full POSIX pthread specification (please see mailarchive.com and cygwin.com). I am able to compile successfully using the flag
-DMDB_USE_ROBUST=0
, as suggested in this comment on the LMDB repo. However, I am not able toimport lmdb
after installation.Errors/exceptions Encountered
When trying to
pip install lmdb
without-DMDB_USE_ROBUST=0
, I get the following:When I
pip install lmdb
with-DMDB_USE_ROBUST=0
, when trying toimport lmdb
, I get the following: