It doesn’t appear in search.nixos.org (python39 has zero results) or nix search (same behavior) so how do I install python 3.9 — I have a program that needs python3.9 specifically.
Two rather quick options for Python 3.9:
Option 1: Use uv
Install uv with nix-shell
nix-shell -p uv
Install Python 3.9:
uv python install 3.9
Create and activate environment:
uv venv --python 3.9
source .venv/bin/activate
python --version
Option 2: Use Cachix to avoid compilation
This is the more “Nix” like way.
First time setup (not 100% necessary but avoids manual compilation):
cachix use nixpkgs-python
Now the shell should be much faster:
nix shell github:cachix/nixpkgs-python#'"3.9"'
I’d probably use the uv way.
only option 2 works on my system; option 1 results in the following:
$ python3.9
Could not start dynamically linked executable: python3.9
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
can an equivalent of python39Packages.av be installed via cachix?
I’ve tried scrolling through git commit history like every retard who’d dumbly suggested such a solution but found nothing related to any package that would aid me in building audiocraft on NixOS.
Is there a way to install python3.9 via configuration.nix?
Yes, but installing a runtime or compiler via system or home configuration usually doesn’t work well.
Python 3.9 has reached the end of its life: Status of Python versions
In particular, that means it won’t even get security updates anymore.
Thus python39 was removed from Nixpkgs in python39: drop by mweinelt · Pull Request #397258 · NixOS/nixpkgs · GitHub.
I guess this repository by Meta, the 22nd largest US company by revenue, is dependent on a life-ended package until something happens.