by zokier · 2y ago · 0 comments
I bring this up because this is such a common topic to complain about, and there is this sentiment that Python packaging is completely broken and unusable. But for me, and I suspect a large quiet userbase, stuff just works fine, and I don't think this side gets brought up nearly enough. And for people not actively using Python, it's important to note that you don't need a rube-goldberg setup like in TFA.
Different OSes is a bit more annoying. I tend to just get VMs involved and do the build on the target OS.
About a month ago I set up a "homedir python" using pyenv, to hopefully solve this problem once and for all. So far it seems to be working great.
Though for projects I've been playing with poetry and rye the last year, basically just as syntactic sugar over venv, mostly just to try them out. They work fine, though I don't understand why "rye shell" is being deprecated.
I try to keep things simple.
pip’s depset builder is also non-deterministic up to its stated capabilities: at the stated capabilities dependency resolution is IIRC exactly NP-hard, it’s in that “you’re using a SAT solver but it will usually be fine” neck of the woods which is why more modern stuff (including I think apt and other Debian-adjacent stuff) use solvers now. You can limit the use of version ranges, you can pin like Bazel does with depsets (usually). This is why running pip repeatedly often solves the problem: you rolled a better character and/or it was hinted by a previous run.
Docker and friends can help but you get the usual Docker headaches, especially with qemu in the mix. I find OrbStack is just a strictly better option everywhere I’ve tried it, but docker over emulation/virtualization is rarely any kind of fun in the presence of accelerators.
So, I want to run an LLM or SD or some other now common thing, but I’ve got an NVIDIA box on x86_64-linux and a Mac on aarch64-darwin. What do I do? That sounds reasonable right?
Good luck. I went the whole way with Nix last time, and it solved lots of other problems (and in that world, problems stay solved until you are compelled to do a non-trivial update), but Python was still a nightmare.
This time I’m trying flox: and so far it’s been friggin awesome. It’s a little rough here and there for advanced users, but flox install pip, pip install torch/etc, and go? That works. On like, 7 os/cpu/accelerator combinations I’ve tried.
It probably sounds like I’m on their payroll but I’m legitimately just a very, very happy user who posts on HN in between excellent interactions with my bedrock env tool now. I hang out in their Slack but I don’t work there.
I'd say it is a good idea to pin python version in your project just like you'd pin any library - after all, there are changes to the standard library all the time. But how to do that in practice. Fuck me if I know a good way.