Something in my system has a python2 dependency, and I don't know how to find it

I made a change in my NixOS configuration, I reverted that change, because it got me:

[nixos@nixos:~/nixcfg]$ nix build './'
error: Package ‘python-’ in /nix/store/s02jdlqmv902b0y19jy4kybl86ylwvvy-source/pkgs/development/interpreters/python/cpython/2.7/default.nix:330 is marked as insecure, refusing to evaluate.


(full taceback)

Now, after reverting, I’m still seem to be stuck with that obsolete python2 dependency that wasn’t there before. I cannot figure out where it comes from and how to get rid of it. Running why-depdends doesn’t really tell me much:

[nixos@nixos:~/nixcfg]$ nix why-depends --all './' /nix/store/n0qfrr5i95p0r5iqdb70dp3i73mzfw7n-python-
│   └───/nix/store/n0qfrr5i95p0r5iqdb70dp3i73mzfw7n-python-
    │   └───/nix/store/v1glf84b5rfaw5a4i00fk47dwrcnkgf2-system-path
    │   ├───/nix/store/ga9n5z66drs6xwfcfwjb7fac50w9gl8l-unit-systemd-fsck-.service
    │   │   └───/nix/store/v1glf84b5rfaw5a4i00fk47dwrcnkgf2-system-path
    │   └───/nix/store/l08qgxxgh6jfr8s3kzsrawrrrzhx3snh-unit-dbus.service
    │       └───/nix/store/rmy8qgx8b7l7zigrvsfzl397c0q1ll22-X-Restart-Triggers
    │           └───/nix/store/ydpmic5a6fn7r8qij2rha6dkb6bp5sj7-dbus-1

Any ideas on how to debug this?

This is always a bit of a PITA when it’s not obvious from why-depends, this suggests python2 is added directly to environment.systemPackages or consorts (a python on your $PATH probably points to python 2, in fact), which obviously you’ve not done deliberately, so it’s probably part of some module or something.

Luckily python is an interpreter, maybe you can find the culprit with ps aux | grep python?


Thanks, that got me on the right track. One of my inputs had set follows to an older version of nixpkgs and was probably thinking pkgs.python was Python 3, when in fact it was Python 2. The change and revert was just coincidental, it was re-locking that introduced the problem, which I hadn’t reverted.

1 Like