News for hackers. Stuff that matters.
Re:Python Wheels Crosses 90% by IshKebab on Monday June 08, 2020 @07:51AM (#23455707)
Assuming you are genuinely asking... Python programs are almost always run from source, and they usually import third party libraries. Those libraries are installed by Pip... somewhere on your system. And then Python has to find it somehow at runtime. That relies on environment variables being set correctly, and works differently on different systems and is basically a huge mess even before you consider things like virtualenv and the fact that non-Linux systems usually have multiple copies of Python installed (and Python 2 and 3!).

It's basically a huge mess. There's even an XKCD about it.

Consider the alternative: Go compiles programs to a single statically linked executable with no dependencies. You literally just copy one file to your target machine and run it. It basically can't fail. That's part of the reason Go is so popular for server stuff.

And it's not just because Python isn't compiled. Other scripting languages handle this much better. Even JavaScript - for all the hate node_modules gets for being enormous, at least it works reliably!

Re:Python Wheels Crosses 90% by Spiritus on Monday June 08, 2020 @10:03AM (#23456548)
Yes, I was genuinely asking. I'm very familiar with how the Python ecosystem works (I've been using it professionally for the past 8 years or so), and I disagree with your assessment. At least not when comparing to other dynamic languages.

> Those libraries are installed by Pip... somewhere on your system.

They go into your virtualenv.

> And then Python has to find it somehow at runtime.

If you use a virtualenv, this works 99.9% of the time.

> That relies on environment variables being set correctly

What environment variables? Just use `./venv/bin/python` directly without environment variables.

> a huge mess even before you consider things like virtualenv

There's nothing to consider, always use a virtualenv. It's the same for thing for Node, except it implicitly handles it for you.

> and the fact that non-Linux systems usually have multiple copies of Python installed (and Python 2 and 3!).

How is that a problem? Just pick the interpreter you want to use when creating the virtualenv:

    virtualenv -p /usr/bin/python2 venv
    virtualenv -p python3 venv
    virtualenv -p python3.7 venv
> Consider the alternative: Go compiles programs to a single statically linked executable with no dependencies. You literally just copy one file to your target machine and run it. It basically can't fail. That's part of the reason Go is so popular for server stuff.

I agree that Go got it mostly right and it just works, except for that fact that it didn't even have a package manager for like 10 years so pinning dependencies was impossible unless you forked repositories.

> Even JavaScript - for all the hate node_modules gets for being enormous, at least it works reliably!

In what way is Python + virtualenv + requirements.txt less reliable?

Re:Python Wheels Crosses 90% by IshKebab on Thursday June 11, 2020 @07:44AM (#23487776)
"There's no issue, it's easy! Just don't do it the obvious way. Instead use this other tool, then create an environment, and don't forget to activate it. You need to specify the interpreter you want, and then installing the dependencies is simple, just run `pip3 install -r requirements.txt`. I don't know what the problem is?"

> It's the same for thing for Node, except it implicitly handles it for you.

Indeed.

Re:Python Wheels Crosses 90% by ghshephard on Monday June 08, 2020 @11:10AM (#23457163)
100% agree with the one addendum that you may want to use virtualenvwrapper.sh - as it makes using virtualenv somewhat more convenient. Mostly syntactic sugar though.
Re:Python Wheels Crosses 90% by marton_s on Monday June 08, 2020 @12:21PM (#23457947)
> for all the hate node_modules gets for being enormous, at least it works reliably!

Funnily enough node_modules is one of the main regrets Ryan Dahl, the creator of Node.js has: https://www.youtube.com/watch?v=M3BM9TB-8yA&t=755s

Re:Python Wheels Crosses 90% by IshKebab on Thursday June 11, 2020 @07:35AM (#23487706)
Yeah it's not a great design but it does at least work reliably!