Hacker News new | ask | show | jobs
by whywhywhywhy 550 days ago
Really the issue is python itself, it shouldn't be treating it's installs and packages as something that's linked and intertwined to the base operating system.

People like to complain about node packages but never seen people have the trouble with them that they have with python.

3 comments

What do you do though if you want to import code written in C++? Especially complex, dependency-heavy like CUDA/ML stuff?

You can just give up and say that "The proper way to do this is to use the Nvidia CUDA toolkit to write your cuda app in C++ and then invoke it as a separate process from node" [0]. That apparently works for node, but Python wants much more.

If you actually want to use high-performance native code in your slow compiled language, then no solution is going to be very good, that's because the problem is inherently hard.

You can rely on host OS as much as possible - if OS is known, provide binaries; if it's unknown, provide source code and hope user has C/C++/Rust/Fortran compilers to build it. That's what uv, pip, etc.. do.

You can create your own parallel OS, bringing your own copy of every math libray, as well as CUDA even if there are perfectly good versions installed on the system - that's what conda/minconda does.

You can implement as much as possible in your own language, so there is much less need to use "high-performance native language" - that's what Rust and Go do. Sadly, that's not an option for Python.

[0] https://stackoverflow.com/questions/20875456/how-can-i-use-c...

>What do you do though if you want to import code written in C++? Especially complex, dependency-heavy like CUDA/ML stuff?

No other CUDA software has to put it's claws deep into the os to function. I'm not even convinced Python does, seems it just dumps all the 500-900meg DLLs into the torch folder. It's more the insistence that the libraries have to exist in this place that isn't related to the project that's the issue.

Node also handles what you're talking about without issue and without thinking it needs to be part of the operating system like Python does.

This is spot on. Running some python projects on nixos is a nightmare because of this model. Especially if it’s ML related.
In Python you need to deliberately mess with the system Python by running your package installer under sudo. That’s not something you do accidentally.

When dealing with the system Python you should always use the system package manager. That extends to Macs for both brew and MacPorts.

I'm not talking about using the "system python" I'm talking about how Python ideologically believes it's running as system python always.

Node loads packages from a subfolder within the project, Python loads packages from somewhere else in the operating system regardless of project so we have an entire ecosystem of wrappers to deal with the nightmare of that ideological choice that Node, Rust, etc just don't need to be usable.

Node is pretty much the only one that uses this model, though.