A little help tracking down build issues?

I don’t have either wxpython or python mentioned in any of my nix files on this machine. Is there a way to find out which package is trying to drag these dependencies along? Sorry if a stupid question

Thanks in advance for any help

Use something like this to find the lastest wxpython you’ve got

ls -t /nix/store | grep wxpython | head -n10

(this lists every file in the nix store, sorted by time, and filters the first then that contain wxpython in the name)

Then try this command with a couple of those (the lastest one might not be the one used by the current system):

nix why-depends /run/current-system /nix/store/[...]-wxpython-4.2.1

Use --show-trace and look from the bottom up.
Also, please use text rather than screenshots, as this is troubleshooting etiquette for logs.

Hey, I have the same issue after switching to unstable, but the ouput of the first command is this:

[mpk@paperclipmaximiser:~]$ ls -t /nix/store | grep wxpython | head -n10

[mpk@paperclipmaximiser:~]$ 

So what can I try now?

Edit: the only thing wxpython I can find is

/nix/store/1awhs5c76hzxam966kaypxd6gvn1ggdg-nixos/nixos/pkgs/development/python-modules/wxpython/4.2.nix

Currently, wxpython is disabled for python 3.12 (See python312Packages.wxpython: disable · NixOS/nixpkgs@3e29c48 · GitHub)

In the meantime, this can be fixed by using the following overlay (not tested, but should work):

  nixpkgs.overlays = [
    (final: prev: rec {
      python = prev.python.override {
        packageOverrides = final: prev: { inherit (pkgs.python311Packages) wxpython; };
      };
      pythonPackages = python.pkgs;
    })
  ];
1 Like

I didn’t get to test this until now, but I either don’t know how to use this or it doesn’t work. I get the same error as before

Okay it seems the problem for me is with printrun, commenting it out fixes the issue for me for now.

1 Like

I think it just doesn’t work, but it was worth trying. Fortunately, a fix for this issue is currently on its way in python312Packages.wxpython: fix build by wegank · Pull Request #326142 · NixOS/nixpkgs · GitHub

1 Like

Old trusty (ignoring the issue until someone else fixes it) reliable as always :smiley:

Thanks for the effort anyways!

1 Like

I hope this gets fixed soon, I tried the overlay with no luck as well, currently unable to update my system :confused:

1 Like

The PR is still a work in progress and can change in the future, but I guess it works fine in its current iteration (as far as I know).

Thankfully, I figured out how to properly do the overlay (the trick is using python3, not python :wink: ) with changes from the PR:

    (final: prev: rec {
      python3 = prev.python3.override {
        packageOverrides = self: super: {
          wxpython =
            let
              waf_2_0_25 = pkgs.fetchurl {
                url = "https://waf.io/waf-2.0.25";
                hash = "sha256-IRmc0iDM9gQ0Ez4f0quMjlIXw3mRmcgnIlQ5cNyOONU=";
              };
            in
            super.wxpython.overrideAttrs {
              disabled = null;
              postPatch = ''
                cp ${waf_2_0_25} bin/waf-2.0.25
                chmod +x bin/waf-2.0.25
                substituteInPlace build.py \
                  --replace-fail "wafCurrentVersion = '2.0.24'" "wafCurrentVersion = '2.0.25'" \
                  --replace-fail "wafMD5 = '698f382cca34a08323670f34830325c4'" "wafMD5 = 'a4b1c34a03d594e5744f9e42f80d969d'" \
                  --replace-fail "distutils.dep_util" "setuptools.modified"
              '';
            };
        };
      };
      python3Packages = python3.pkgs;
    })

With this, wxpython builds successfully for python 3.12 on my machine.

By the way, I ended up fixing like this:

ls -t /nix/store | grep wxpython | head -n10

to check what I had installed and then

nix-store --query --referrers /nix/store/${wxpython-path}

showed me the packages that were using this dependency

after removing them, the system as able to build. for me, the package was woeusb-ng

ls -t is clever, but in general I’d probably lean away from just ls-ing in the store.
I made a suggestion at How to find which package dependency it is? - #3 by waffle8946 of how to deal with this scenario, basically slapping --show-trace 2>/dev/stdout | grep 'while evaluating derivation' on the rebuild command might give you better answers.

Also to the overall thread, packageOverrides is long deprecated, I’m surprised it even works half the time… IMO should be removed from nixpkgs entirely.

You’ll want to use overrideScope instead if you still want to go ahead with the overlay:

python3Packages = final.python3Packages.overrideScope ( ... )