Building an older python version

Hi,

I’d like to have python3.6 available in nix.
The reason is that I need to build some python packages (wheels) for a centos 7 system that has a offline installer.

I see python3.6 was removed in this changeset: python36: remove · NixOS/nixpkgs@846e2b1 · GitHub

I hacked together a python3.6 build based on the above and some examples I found on stack overflow.

Without the “withPackages” function it seems to build python3.6 okay,
but as soon as I add the withPackages function, it just builds the default 3.10 again.

How does the withPackages function work? I don’t see it in the python source anywhere: https://github.com/NixOS/nixpkgs/blob/f8b026c478c5c2fdd558fc04ea307082ddc30e94/pkgs/development/interpreters/python/cpython/default.nix

Is there a way to build python 3.6 and still have some packages available in the environment?

1 Like

That was the case in the past but the package set won’t be available again because maintaining more python versions is a pain and not worth it for the goals that pythonPackages have in nixpkgs.

You are looking into the cpython specific code but you want to search in the generic python interpreter code https://github.com/NixOS/nixpkgs/blob/97e7b0e43c931ce73d845d35efda2017c4cd9792/pkgs/development/interpreters/python/default.nix#L100

Building python 3.6 itself should be doable but having the packages compile is not possible without major pain and suffering.

Also I am pretty sure that you’re overwrite is not enough to build a python 3.6 like we did back when it was a thing.

1 Like