jnwatson / py-lmdb

Universal Python binding for the LMDB 'Lightning' Database
http://lmdb.readthedocs.io/
Other
646 stars 106 forks source link

installing lmdb for bundled Python 3.5.3 from Blender 2.79a in Ubuntu 16.04 #349

Closed monajalal closed 1 year ago

monajalal commented 1 year ago

I tried with and without the flag and both fails. Do you have any recommendation?

(pvrender) mona@mona-VirtualBox:~/py-lmdb$ python setup.py install
py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1.
patching file lmdb.h
patching file mdb.c
py-lmdb: Using CPython extension; override with LMDB_FORCE_CFFI=1.
running install
running bdist_egg
running egg_info
writing dependency_links to lmdb.egg-info/dependency_links.txt
writing top-level names to lmdb.egg-info/top_level.txt
writing lmdb.egg-info/PKG-INFO
reading manifest file 'lmdb.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'lmdb/__pycache__'
writing manifest file 'lmdb.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying lmdb/_config.py -> build/lib.linux-x86_64-3.5/lmdb
running build_ext
building 'cpython' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilib/py-lmdb -Ibuild/lib -I/home/mona/pvrender/include -I/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/include/python3.5m -c lmdb/cpython.c -o build/temp.linux-x86_64-3.5/lmdb/cpython.o -DHAVE_PATCHED_LMDB=1 -UNDEBUG -w
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilib/py-lmdb -Ibuild/lib -I/home/mona/pvrender/include -I/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/include/python3.5m -c build/lib/mdb.c -o build/temp.linux-x86_64-3.5/build/lib/mdb.o -DHAVE_PATCHED_LMDB=1 -UNDEBUG -w
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilib/py-lmdb -Ibuild/lib -I/home/mona/pvrender/include -I/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/include/python3.5m -c build/lib/midl.c -o build/temp.linux-x86_64-3.5/build/lib/midl.o -DHAVE_PATCHED_LMDB=1 -UNDEBUG -w
gcc -pthread -shared -L/opt/lib/bz2/lib -L/opt/lib/lzma/lib -L/opt/lib/ssl/lib -L/opt/lib/zlib/lib -L/opt/lib/libc6/lib -L/opt/lib/ncurses/lib -L/opt/lib/gpm/lib -L/opt/lib/sqlite/lib -L/opt/lib/readline/lib -Wl,--version-script=python.map build/temp.linux-x86_64-3.5/lmdb/cpython.o build/temp.linux-x86_64-3.5/build/lib/mdb.o build/temp.linux-x86_64-3.5/build/lib/midl.o -o build/lib.linux-x86_64-3.5/lmdb/cpython.cpython-35m-x86_64-linux-gnu.so
/usr/bin/ld: cannot open linker script file python.map: No such file or directory
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
(pvrender) mona@mona-VirtualBox:~/py-lmdb$ LMDB_FORCE_CFFI=1 python setup.py install
py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1.
patching file lmdb.h
patching file mdb.c
Using cffi extension.
/usr/bin/ld: cannot open linker script file python.map: No such file or directory
collect2: error: ld returned 1 exit status
Traceback (most recent call last):
  File "/home/mona/py-lmdb/lmdb/__init__.py", line 41, in <module>
    raise ImportError
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/unixccompiler.py", line 196, in link
    self.spawn(linker + ld_args)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/spawn.py", line 159, in _spawn_posix
    % (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/ffiplatform.py", line 51, in _build
    dist.run_command('build_ext')
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/mona/pvrender/lib/python3.5/site-packages/setuptools/command/build_ext.py", line 79, in run
    _build_ext.run(self)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/command/build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/command/build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/mona/pvrender/lib/python3.5/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
    _build_ext.build_extension(self, ext)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/command/build_ext.py", line 558, in build_extension
    target_lang=language)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/ccompiler.py", line 717, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/unixccompiler.py", line 198, in link
    raise LinkError(msg)
distutils.errors.LinkError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 180, in <module>
    import lmdb.cffi
  File "/home/mona/py-lmdb/lmdb/__init__.py", line 48, in <module>
    from lmdb.cffi import *
  File "/home/mona/py-lmdb/lmdb/cffi.py", line 379, in <module>
    library_dirs=_config_vars['extra_library_dirs'])
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/api.py", line 468, in verify
    lib = self.verifier.load_library()
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/verifier.py", line 105, in load_library
    self._compile_module()
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/verifier.py", line 202, in _compile_module
    outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/ffiplatform.py", line 22, in compile
    outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/ffiplatform.py", line 58, in _build
    raise VerificationError('%s: %s' % (e.__class__.__name__, e))
cffi.VerificationError: LinkError: command 'gcc' failed with exit status 1

sys info:

(pvrender) mona@mona-VirtualBox:~/py-lmdb$ uname -a
Linux mona-VirtualBox 4.15.0-112-generic #113~16.04.1-Ubuntu SMP Fri Jul 10 04:37:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
(pvrender) mona@mona-VirtualBox:~/py-lmdb$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.7 LTS
Release:    16.04
Codename:   xenial
(pvrender) mona@mona-VirtualBox:~/py-lmdb$ python --version
Python 3.5.3
(pvrender) mona@mona-VirtualBox:~/py-lmdb$ which python
/home/mona/pvrender/bin/python
(pvrender) mona@mona-VirtualBox:~/py-lmdb$ echo $PATH
/home/mona/pvrender/bin:/home/mona/bin:/home/mona/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
(pvrender) mona@mona-VirtualBox:~/py-lmdb$ echo $LD_LIBRARY_PATH
/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib
(pvrender) mona@mona-VirtualBox:~/py-lmdb$ which -a python
/home/mona/pvrender/bin/python
/usr/bin/python
(pvrender) mona@mona-VirtualBox:~/py-lmdb$ ls ~/blender-2.79a-linux-glibc219-x86_64/2.79/python/bin/python3.5m 
-rwxr-xr-x 1 mona mona 12M May 18  2017 /home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/bin/python3.5m
jnwatson commented 1 year ago

Since you used "python setup.py install" it is going to have to build it from source. You don't have tools installed to build it from source. Install "gcc" and try again.

monajalal commented 1 year ago

I already have gcc installed and it is the newest version. Can you please open the issue? Because it is not resolved!

(pvrender) mona@mona-VirtualBox:~/py-lmdb$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(pvrender) mona@mona-VirtualBox:~/py-lmdb$ python setup.py install
py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1.
patching file lmdb.h
patching file mdb.c
py-lmdb: Using CPython extension; override with LMDB_FORCE_CFFI=1.
running install
running bdist_egg
running egg_info
writing dependency_links to lmdb.egg-info/dependency_links.txt
writing top-level names to lmdb.egg-info/top_level.txt
writing lmdb.egg-info/PKG-INFO
reading manifest file 'lmdb.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
writing manifest file 'lmdb.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying lmdb/_config.py -> build/lib.linux-x86_64-3.5/lmdb
running build_ext
building 'cpython' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilib/py-lmdb -Ibuild/lib -I/home/mona/pvrender/include -I/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/include/python3.5m -c lmdb/cpython.c -o build/temp.linux-x86_64-3.5/lmdb/cpython.o -DHAVE_PATCHED_LMDB=1 -UNDEBUG -w
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilib/py-lmdb -Ibuild/lib -I/home/mona/pvrender/include -I/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/include/python3.5m -c build/lib/mdb.c -o build/temp.linux-x86_64-3.5/build/lib/mdb.o -DHAVE_PATCHED_LMDB=1 -UNDEBUG -w
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilib/py-lmdb -Ibuild/lib -I/home/mona/pvrender/include -I/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/include/python3.5m -c build/lib/midl.c -o build/temp.linux-x86_64-3.5/build/lib/midl.o -DHAVE_PATCHED_LMDB=1 -UNDEBUG -w
gcc -pthread -shared -L/opt/lib/bz2/lib -L/opt/lib/lzma/lib -L/opt/lib/ssl/lib -L/opt/lib/zlib/lib -L/opt/lib/libc6/lib -L/opt/lib/ncurses/lib -L/opt/lib/gpm/lib -L/opt/lib/sqlite/lib -L/opt/lib/readline/lib -Wl,--version-script=python.map build/temp.linux-x86_64-3.5/lmdb/cpython.o build/temp.linux-x86_64-3.5/build/lib/mdb.o build/temp.linux-x86_64-3.5/build/lib/midl.o -o build/lib.linux-x86_64-3.5/lmdb/cpython.cpython-35m-x86_64-linux-gnu.so
/usr/bin/ld: cannot open linker script file python.map: No such file or directory
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
(pvrender) mona@mona-VirtualBox:~/py-lmdb$ sudo apt install gcc
[sudo] password for mona: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
gcc is already the newest version (4:5.3.1-1ubuntu1).
monajalal commented 1 year ago

also, when I tried it with sudo pip install lmdb I got this error when importing it:

(pvrender) mona@mona-VirtualBox:~/py-lmdb$ sudo pip install lmdb
The directory '/home/mona/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/mona/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): lmdb in /usr/lib/python2.7/dist-packages
You are using pip version 8.1.1, however version 23.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(pvrender) mona@mona-VirtualBox:~/py-lmdb$ python
Python 3.5.3 (default, May 18 2017, 14:40:48) 
[GCC 5.4.1 20161019] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lmdb
/usr/bin/ld: cannot open linker script file python.map: No such file or directory
collect2: error: ld returned 1 exit status
Traceback (most recent call last):
  File "/home/mona/py-lmdb/lmdb/__init__.py", line 42, in <module>
    from lmdb.cpython import *
ImportError: No module named 'lmdb.cpython'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/unixccompiler.py", line 196, in link
    self.spawn(linker + ld_args)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/spawn.py", line 159, in _spawn_posix
    % (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/ffiplatform.py", line 51, in _build
    dist.run_command('build_ext')
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/command/build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/command/build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/command/build_ext.py", line 558, in build_extension
    target_lang=language)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/ccompiler.py", line 717, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "/home/mona/blender-2.79a-linux-glibc219-x86_64/2.79/python/lib/python3.5/distutils/unixccompiler.py", line 198, in link
    raise LinkError(msg)
distutils.errors.LinkError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mona/py-lmdb/lmdb/__init__.py", line 48, in <module>
    from lmdb.cffi import *
  File "/home/mona/py-lmdb/lmdb/cffi.py", line 379, in <module>
    library_dirs=_config_vars['extra_library_dirs'])
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/api.py", line 468, in verify
    lib = self.verifier.load_library()
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/verifier.py", line 105, in load_library
    self._compile_module()
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/verifier.py", line 202, in _compile_module
    outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/ffiplatform.py", line 22, in compile
    outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
  File "/home/mona/pvrender/lib/python3.5/site-packages/cffi/ffiplatform.py", line 58, in _build
    raise VerificationError('%s: %s' % (e.__class__.__name__, e))
cffi.VerificationError: LinkError: command 'gcc' failed with exit status 1