Python binding: import gpg -> ImportError: cannot import name 'gpgme' from partially initialized module 'gpg'

Johannes Schauer Marin Rodrigues josch at mister-muffin.de
Tue Jan 14 16:09:36 CET 2025


Hi,

steps to reproduce:

python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install gpg
python3 -c "import gpg"

This will output:

Successfully built gpg
Installing collected packages: gpg
Successfully installed gpg-1.10.0
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/.venv/lib/python3.10/site-packages/gpg/__init__.py", line 101, in <module>
    from . import core
  File "/.venv/lib/python3.10/site-packages/gpg/core.py", line 34, in <module>
    from . import gpgme
ImportError: cannot import name 'gpgme' from partially initialized module 'gpg' (most likely due to a circular import) (/.venv/lib/python3.10/site-packages/gpg/__init__.py)

This is on Ubuntu Jammy. You can reproduce this in a clean chroot environment
with just python3-venv build-essential and libgpgme-dev installed on top of the
default package set.

I hope this is the right list for this issue and I hope maybe somebody can shed
some light on this situation. :)

Thanks!

cheers, josch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: signature
URL: <https://lists.gnupg.org/pipermail/gcrypt-devel/attachments/20250114/85815eaa/attachment.sig>


More information about the Gcrypt-devel mailing list