Page MenuHome GnuPG

GPGME: Python bindings dont work after build
Closed, InvalidPublic

Description

Hi,

On a fresh Ubuntu 17.04

cloning current git HEAD of the GPGME repo
after make install completes

i get this on importing the python bindings

>>> import gpg
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gpg/gpgme.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 914, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: /usr/local/lib/python3.5/dist-packages/gpg/_gpgme.cpython-35m-x86_64-linux-gnu.so: symbol gpgme_op_decrypt_ext_start, version GPGME_1.1 not defined in file libgpgme.so.11 with link time reference

btw, is there a easier way to get GPGME including python bindings installed on debian, without building it ourself?
maybe a package?

i found this: https://packages.debian.org/experimental/libgpgme11

but it contains only the library, not the bindings

Details

Version
current HEAD

Event Timeline

werner triaged this task as Normal priority.
werner added a project: Python.

This is a bug tracker, not a support forum.

cloning current git HEAD of the GPGME repo
after make install completes

make check or it didn't happen.

i get this on importing the python bindings

import gpg

Traceback (most recent call last):

File "/usr/local/lib/python3.5/dist-packages/gpg/gpgme.py", line 18, in swig_import_helper
  return importlib.import_module(mname)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
  return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 914, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed

ImportError: /usr/local/lib/python3.5/dist-packages/gpg/_gpgme.cpython-35m-x86_64-linux-gnu.so: symbol gpgme_op_decrypt_ext_start, version GPGME_1.1 not defined in file libgpgme.so.11 with link time reference

I guess it is picking up the wrong version of GPGME, i.e. the one from your distribution and not the one you built. Check:

ldd /usr/local/lib/python3.5/dist-packages/gpg/_gpgme.cpython-35m-x86_64-linux-gnu.so

and use LD_LIBRARY_PATH to point it to the right one.

btw, is there a easier way to get GPGME including python bindings installed on debian, without building it ourself?
maybe a package?

Yes. It is called python-gpg and python3-gpg.

Thanks, LD_LIBRARY_PATH solved the problem