News for hackers. Stuff that matters.
Re:This Is What Python Beginners Have to Deal With by talideon on Thursday September 08, 2016 @06:27AM (#12451730)
I really don't know of anything like pip that can handle that case in any language, and I'm not entirely convinced that somehow resolving the plethora of naming conventions for packages between different distros (and even different vesions of those distros) is really the job of a language-specific package manager.

Nobody's done it because any potential solutions are much too brittle. On Debian derivatives, it's not too big a problem, but go outside of that, and even high-level tooling is a mess (the tooling on top of RPM varies from distro to distro, and even version to version). On macOS, if you're using a ports-like system, you might be dealing with fink, MacPorts, brew, pkgsrc, &c.

Any competently-managed project, OTOH, will list the dependencies for a number of major distros and OSs so that the person installing it will have an idea what to look for.

I'm all ears for a reasonable solution to this, if you have one.

Re:This Is What Python Beginners Have to Deal With by crdoconnor on Thursday September 08, 2016 @08:45AM (#12452427)
>I really don't know of anything like pip that can handle that case in any language, and I'm not entirely convinced that somehow resolving the plethora of naming conventions for packages between different distros (and even different vesions of those distros) is really the job of a language-specific package manager.

I actually started probably the only project to actually make a stab at solving this: https://github.com/unixpackage/unixpackage

However, I'm loath to continue working on it because there are few tasks more tedious, filled with annoying edge cases and thankless than this. Plus I know it would never make it into pip because "it's not pip's job".

>I'm all ears for a reasonable solution to this, if you have one.

The only one I can think of is to packages like libpq-dev and libjpeg-dev and even the C compiler installable via pip and get the maintainers of pillow/psycopg2/whatever else to remove all their horrible hacky code to look for these dependencies on the system itself.

This will balloon the size of virtualenvs and increase installation times but it'll be worth it. Not only will it eliminate those horrible installation errors making everybody happy (not just beginners), it will eliminate a nasty source of brittleness (subtly different behavior caused by different versions of these packages on different platforms).

Re:This Is What Python Beginners Have to Deal With by talideon on Thursday September 08, 2016 @11:25AM (#12453883)
> However, I'm loath to continue working on it because there are few tasks more tedious, filled with annoying edge cases and thankless than this.

That, in a nutshell, is the problem.

> Plus I know it would never make it into pip because "it's not pip's job".

There are good reasons it wouldn't make it into pip: something like that is more the realm of setuptools, rather than pip.

> The only one I can think of is to packages like libpq-dev and libjpeg-dev and even the C compiler installable via pip and get the maintainers of pillow/psycopg2/whatever else to remove all their horrible hacky code to look for these dependencies on the system itself.

The 'horrible hacky code' is autotools 90% of the time, and while I'd like to see if die in a fire and for pkgconf to replace it as far as library detection goes, it's not going away any time soon.

Also, there is next to no chance of what you propose happening: you're essentially proposing a parallel system package management system, and at that point you'd might as well just propose that the Python packaging toolchain integrate, I don't know, maybe pkgsrc into itself.

Re:This Is What Python Beginners Have to Deal With by crdoconnor on Thursday September 08, 2016 @12:10PM (#12454318)
>That, in a nutshell, is the problem.

That problem can be solved with money. I've seen Jessica McKellar offer to shower PSF money over people who want to help make installation of python easier for beginners on Windows. I've not seen her offer to shower money over anybody wanting to solve this problem.

And, as I mentioned before I don't believe a solution like that unixpackage would actually make it into pip. They'd refuse it.

That, in the nutshell, is the problem.

>There are good reasons it wouldn't make it into pip: something like that is more the realm of setuptools, rather than pip.

Maybe. I'm never really sure where one ends and the other begins, to be honest. Perhaps that's part of the problem.

>you're essentially proposing a parallel system package management system,

I am, yes. And as ridiculous as that may sound it's utterly crucial.

>and at that point you'd might as well just propose that the Python packaging toolchain integrate, I don't know, maybe pkgsrc into itself.

That would be my other proposal, yes. Either pkgsrc, guix or nix.

>Also, there is next to no chance of what you propose happening

Want to know what's really shit about python?

Re:This Is What Python Beginners Have to Deal With by talideon on Thursday September 08, 2016 @01:53PM (#12455350)
No, this is a significantly bigger problem than simply getting things to work well on Windows.

Have you proposed this to anyone in the PSF?

> Maybe. I'm never really sure where one ends and the other begins, to be honest. Perhaps that's part of the problem.

In a nutshell, leaving out various details: pip downloads packages, asks them for their dependencies, downloads the dependencies, asks them for their dependencies, and so on, and so on. Then it does a topological sort and asks them to install themselves.

The process of installation is done by the setup.py file within the package[1]. That's setuptools.

The line between the two is pretty clear; this is similar to the split between dpkg/apt or rpm/yum, except setuptools itself has some built-in dependency resolution support.

[1] Assuming it's not a wheel.

> I am, yes. And as ridiculous as that may sound it's utterly crucial.

And a security nightmare.

> Want to know what's really shit about python?

Do you know what's shit about dealing with just about every language out there? Pick a language with its own package management, and the moment it steps outside of its own runtime environment, this problem crops up.

Want to know why I think there's little chance of this working? It's nothing to do with Python and everything to do this being a nightmare for sysadmins.

Re:This Is What Python Beginners Have to Deal With by crdoconnor on Thursday September 08, 2016 @03:26PM (#12456424)
>Have you proposed this to anyone in the PSF?

I'm not interested in getting involved in their politics.

>And a security nightmare.

Absurd.

>Do you know what's shit about dealing with just about every language out there?

Not this. You might have noticed a variety of java programmers saying "nope, not an issue here".

>Pick a language with its own package management, and the moment it steps outside of its own runtime environment

The issue is not at all to do with stepping outside of the runtime environment and everything to do with running code in an uncontrolled environment. The solution is to control the environment as much as you can and fail cleanly if you can't.

>Want to know why I think there's little chance of this working?

No, I have no interest in what you think any more.

Re:This Is What Python Beginners Have to Deal With by talideon on Thursday September 08, 2016 @05:53PM (#12457682)
> I'm not interested in getting involved in their politics.

Then why did you even bring them up?

> Absurd.

Not if you're a sysadmin.

> Not this. You might have noticed a variety of java programmers saying "nope, not an issue here".

Because JNI is barely used. This isn't the case with Python, or Ruby, or a host of other lanuages.

> No, I have no interest in what you think any more.

Don't be an ass.

Re:This Is What Python Beginners Have to Deal With by dkersten on Thursday September 08, 2016 @07:04AM (#12451882)
I really don't know of anything like pip that can handle that case in any language

I've never ever had to think about it with the Java ecosystem. I just get a jar and stuff magically works.

Re:This Is What Python Beginners Have to Deal With by talideon on Thursday September 08, 2016 @11:14AM (#12453763)
If everything's native[1], whether you're talking about Python, Java, or any other language, you're golden.

The issue arises when you're calling out to something written in, say, C. You'll have the same pain in java if you start using JNI to call across the JVM boundary. It just crops up more in Python because C extensions get used a lot in Python.

Addendum:

[1] By this, I mean within the boundaries of the runtime environment and not using things like Python's C extension API or JNI. 'Native' is a poor choice of words.

Re:This Is What Python Beginners Have to Deal With by dkersten on Friday September 09, 2016 @04:44AM (#12460502)
My point was that I've never had to care if a jar contained C libraries or not. Some do, many don't, but I've never had to care. Maybe I've just been lucky.

I suppose it could have been a fat-jar thing: if the jar contains its non-java dependencies for my platform, then everything just works. If the native libs are separate, then sure, its a similar issue as described elsewhere here.

Re:This Is What Python Beginners Have to Deal With by crdoconnor on Thursday September 08, 2016 @12:56PM (#12454762)
It isn't really a question of native or non-native. It's more a question of "under the control of the package manager" vs. "not under the control".

You have a similar kind of pain when you have pip and apt trying to manage the system python installation.

Re:This Is What Python Beginners Have to Deal With by talideon on Thursday September 08, 2016 @01:57PM (#12455400)
If all you're doing is using pure Python code, there's no issue: you can install what you like, either with the --user flag or into a virtual environment. This situation is nothing like running pip as root.
Re:This Is What Python Beginners Have to Deal With by crdoconnor on Thursday September 08, 2016 @03:27PM (#12456441)
No, there are issues. If you install packages that have dependencies on libraries which apt-installed packages depend upon then you can break them.

This is all about running code in an uncontrolled environment.

Re:This Is What Python Beginners Have to Deal With by talideon on Thursday September 08, 2016 @05:50PM (#12457664)
This is what virtual environments are for, and your solution still uses virtual environments.

So no, there aren't.

Now, I have a project I'd like to try with per-process mounts of dependencies using unionfs. It'd be a lot of work, and a lot could go wrong, but would solve a lot of problems.

Re:This Is What Python Beginners Have to Deal With by crdoconnor on Thursday September 08, 2016 @06:46PM (#12458100)
>This is what virtual environments are for

Precisely. Virtualenvs solve part of the problem by isolating the python code and its dependencies - but not all of the code.

Apparently extending this behavior would cause security issues of an unknown nature...

Re:This Is What Python Beginners Have to Deal With by yxhuvud on Thursday September 08, 2016 @07:36AM (#12452070)
The solutions are only brittle if the different distribution systems doesn't talk with each other. Someone should gather a bunch of different language level package managers and a bunch of distro level package managers in a room and then not let them out until they have figured out a standardised API to declare, provide and require dependencies.
Re:This Is What Python Beginners Have to Deal With by talideon on Thursday September 08, 2016 @11:32AM (#12453952)
And who is that somebody going to be?

Also, what you're proposing boils down to asking them to all standardise on RPM. Have you asked yourself why all these different package management tools exist in the first place?