Missing python package in checkPhase

I’m currently working on updating Swift to 5.3, and I’m running into some trouble with its test suite. A handful of its tests use Python, and import the six package. I have six as a dependency for the build, but for some reason the python process running these tests is not able to find it.

Strangely enough, when I drop in a small python script of my own, and run it within the checkPhase, that script is able to import six with no problems. The $PYTHONPATH looks correct, and I’ve verified that the python executable being run in the swift tests is the same one from the nix store — version 2.7 in all cases.

I’m not familiar enough with Swift’s build process (or with Python for that matter) to imagine what might be making this package not load. I’m hoping someone on here might have ideas where to look next…

Maybe try adding six to checkInputs?

you can also use withPackages which will create a small “venv” like derivation for you.

  checkInputs = [
    (python3Packages.withPackages (ps: with ps; [ six ]))

The major difference is that all of the packages will be symlink joined into the interpreters site packages, so it’s “as if” the packages were just installed globally

@jonringer Thanks, I’ll give that a try and see if that helps. I did try adding just python27Packages.six to checkInputs, but it didn’t make a difference, I assume because it was already in the nativeBuildInputs for the build as a whole.

(Of course, these builds take an hour and a half to get to this point, so debugging is… fun :smirk:)

part of the reason I invested in a 3990X. It eats builds for breakfast

$ time nix-build --cores 128 -A llvm --check

real	2m52.604s
user	0m0.706s
sys	0m0.854s

Just wanted to add, in case anyone is interested, that patching python did end up working to make this build succeed. Hooray! Specifically what I did was

  patchedPython = python.withPackages (ps: [
in {...

and using patchedPython as a build input to the rest of the derivation.

1 Like

Sorry, offtopic but can I ask if you have an integrated GPU or discrete? And in either case, how has your experience been with drivers? I’ve always considered intel integrated graphics to be a (the?) guaranteed hassle free option. Wonder what the AMD situation is… , and specially on NixOS.

I have a discrete nvidia card (1070 FE) for my desktop, and an AMD 5900XT for the server (which is overkill, as I only used it bootstrap it xD)

Nvidia video drivers on NixOS has been pleasurable to use. Essentially just do services.xserver.videoDrivers = [ "nvidia" ];, and the drivers will be built as a part of nixos-rebuild.

AMD drivers have been even more pleasurable. Just use a linux kernel >= 5.4 and you’re done.

I should be using the 5900XT for my desktop, but I already invested in 4k monitors, and downgrading to 1440p (which 5900XT does well, but doesn’t do 4k well), make everything look like hot pixelated garbage.

NixOS + nvidia was much better of an experience than Ubuntu + nvidia. I haven’t used Ubuntu for a few years, and maybe the experience has improved; but I remember having to use the integrated graphics to first download the .run that nvidia distributes and then run the installation. Each subsequent kernel bump would be an undecorated xterm session until I found the .run again, and ran through the installation steps.

NixOS on the other hand, was much easier for video drivers. (Although the learning curve for nixos in general is much, much higher)

1 Like

Thank you for taking the time to write a detailed answer.

The driver situation is very nice to hear. I had actually assumed that NixOS would be worse but glad to know it’s only better.

Being able to declare the entire system ahead-of-time allows you to do some interesting things. I’m sure it’s a similar situation with zfs, in which it’s probably easier to do than other distros.

1 Like