The python statement import gpg fails with an ImportError or ModuleNotFoundError depending on python version and nixpgs channel.
Steps To Reproduce
I am building pkgs.python3.withPackages (p: [p.gpgme]) and then I execute python3 -c 'import gpg' from the result.
I do this for nixpkgs/nixos-24.05 and nixpkgs/nixos-unstable channel and for the python311 and the python312 derivation.
For example like this:
for nixpkgs in nixos-24.05 nixos-unstable; do
for python in python311 python312; do
echo Trying $python from $nixpkgs ...
result=$(nix build -I nixpkgs=flake:nixpkgs/$nixpkgs --impure --print-out-paths \
--expr '(import <nixpkgs> {}).'$python'.withPackages(p:[p.gpgme])')
$result/bin/python3 -c 'import gpg'
done
done
Results:
nixos-24.05 with python3.11: ok
nixos-24.05 with python3.12: ModuleNotFoundError: No module named 'imp'
nixos-unstable with python3.11: ImportError: cannot import name 'gpgme' from partially initialized module 'gpg' (most likely due to a circular import) (/nix/store/y6xyvx9x542x2knw440ajblqy9922q3q-python3-3.11.10-env/lib/python3.11/site-packages/gpg/__init__.py)
nixos-unstable with python3.12: ImportError: cannot import name 'gpgme' from partially initialized module 'gpg' (most likely due to a circular import) (/nix/store/ww0c5w89a905mzr45dqah77crc62rrsr-python3-3.12.7-env/lib/python3.12/site-packages/gpg/__init__.py)
Expected behavior
The module should be imported, no error message.
Additional context
On nixos-24.05 python3.11 is the default for the python3 derivation. On unstable it is 3.12.
Notify maintainers
@dotlambda
Metadata
system: "x86_64-linux"
host os: Linux 6.6.58, NixOS, 24.11 (Vicuna), 24.11.20241025.18536bf
Describe the bug
The python statement
import gpg
fails with anImportError
orModuleNotFoundError
depending on python version and nixpgs channel.Steps To Reproduce
I am building
pkgs.python3.withPackages (p: [p.gpgme])
and then I executepython3 -c 'import gpg'
from the result.I do this for nixpkgs/nixos-24.05 and nixpkgs/nixos-unstable channel and for the python311 and the python312 derivation.
For example like this:
Results:
ModuleNotFoundError: No module named 'imp'
ImportError: cannot import name 'gpgme' from partially initialized module 'gpg' (most likely due to a circular import) (/nix/store/y6xyvx9x542x2knw440ajblqy9922q3q-python3-3.11.10-env/lib/python3.11/site-packages/gpg/__init__.py)
ImportError: cannot import name 'gpgme' from partially initialized module 'gpg' (most likely due to a circular import) (/nix/store/ww0c5w89a905mzr45dqah77crc62rrsr-python3-3.12.7-env/lib/python3.12/site-packages/gpg/__init__.py)
Expected behavior
The module should be imported, no error message.
Additional context
On nixos-24.05 python3.11 is the default for the python3 derivation. On unstable it is 3.12.
Notify maintainers
@dotlambda
Metadata
"x86_64-linux"
Linux 6.6.58, NixOS, 24.11 (Vicuna), 24.11.20241025.18536bf
yes
yes
nix-env (Nix) 2.24.9
/nix/store/wb6agba4kfsxpbnb5hzlq58vkjzvbsk6-source
Add a :+1: reaction to issues you find important.