Are there no precompiled packages on cache.nixos.org for Python?
Does precompilation not work for python, because every user uses different Python package selections?
Or am I doing something wrong in my configuration.nix?
{ config, pkgs, ... }:
let
my-python-packages = python-packages: with python-packages; [
# data sciency stuff
scipy numpy matplotlib pandas ipython
# other
distro pygobject3 pyppeteer requests termcolor flake8
];
in
{
environment.systemPackages = with pkgs; [
(python3Full.withPackages my-python-packages)
];
}
Like the compilation of Python always takes at least an hour, compared to for example Hyprland (a wayland compositor) is only taking approx. a maximum of 15 min.
Or is it not every time, but it happens so regular for me, that I think python updates this infrequent?
You shouldn’t have to compile Python or Hyprland. These are both cached by hydra. Generally when the cache fails like that, it either means you’re following the wrong nixpkgs branch (e.g. master, which is often heavily uncached), or you’ve added an overlay to your setup that is low enough level to cause a ton of things to be rebuilt from scratch.
Are you sure it’s actually Python being compiled? Although Python itself is cached, I don’t think many Python packages are cached. I just tried building your python3Full.withPackages expression and uh… there’s a lot of python packages to build, and a bunch of them are compiling code and running long tests. I think that’s likely what is consuming so much time.
It took my machine 25m18s to build that expression, and I have a 16 core / 32 thread CPU so the compilation parts were compiled with a lot of parallelism (when it was done I had a 15min loadavg of 20).
I think it might be because you’re using python3Full? I just tried the same expression (with a clean store) with python3 instead and it was all cached. Changing back to python3Full, tons of stuff like numpy and scipy were not cached. I dunno why python3Full packages wouldn’t be cached.
Only a single python package set is prebuilt, which is python3Packages. The *Full based sets are generally not prebuilt. unless something within nixpkgs depends on it, and then only that much gets built.
I’m not even sure what pythonFull gives you, what python alone doesn’t, except for longer waiting times
Most users/libraries do not need these additional libraries, which are fairly heavy as well if I recall correctly. So it’s a trade-off.
Back in the days there was also an expression for a more modular CPython but it was difficult to maintain and thus dropped. There were also issues with including those separately built modules again.