NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.27k stars 14.25k forks source link

python: gpg module not importable with python 3.12 #354166

Open lucc opened 2 weeks ago

lucc commented 2 weeks ago

Describe the bug

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:

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


Add a :+1: reaction to issues you find important.

milibopp commented 20 hours ago

This also breaks alot because it is pinned to Python 3.11 for the time being.