this post was submitted on 13 Oct 2023
268 points (100.0% liked)

Programmer Humor

854 readers
1 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

Sorry Python but it is what it is.

top 50 comments
sorted by: hot top controversial new old
[–] felbane@lemmy.ml 38 points 1 year ago* (last edited 1 year ago) (4 children)

If this is from the perspective of a hobbyist or brand new Python dev, that's a fair opinion to have, I suppose.

That said, if you're using Python in a professional capacity, you really need to learn how to use the toolchain properly.

Python packaging and virtual environments are not difficult to understand, and I'd wager based on your comments elsewhere in this thread that your frustrations are born from not taking the time to understand why following the instructions from a fourteen-year-old blog post aren't working.

99.99% of the time, the fault isn't with pip, it's with the maintainer of the broken package you're trying to use.

[–] ExLisper@linux.community 13 points 1 year ago (3 children)

This article someone linked is not 14 years old and it perfectly describes the mess python and pip are: https://chriswarrick.com/blog/2023/01/15/how-to-improve-python-packaging/

My favorite part is:

Most importantly: which tool should a beginner use? The PyPA has a few guides and tutorials, one is using pip + venv, another is using pipenv (why would you still do that?), and another tutorial that lets you pick between Hatchling (hatch’s build backend), setuptools, Flit, and PDM, without explaining the differences between them

But yes, following old blog post is the issue.

[–] GBU_28@lemm.ee 4 points 1 year ago (1 children)

Why not read the official python docs?

[–] NBJack@reddthat.com 4 points 1 year ago (1 children)

Hahaha!....

Oh shit, you're serious.

[–] GBU_28@lemm.ee 3 points 1 year ago (1 children)

They pretty simply describe how to handle a venv, pip, reqs, etc.

[–] NBJack@reddthat.com 4 points 1 year ago

Friend, while I appreciate the time and effort on the docs, it has a rather tiny section on one of the truly worst aspects of pip (and the only one that really guts usability): package conflicts.

Due to the nature of Python as an interpreted language, there is little that you can check in advance via automation around "can package A and package B coexist peacefully with the lowest common denominator of package X"? Will it work? Will it fail? Run your tool/code and hope for the best!

Pip is a nightmare with larger, spawling package solutions (i.e. a lot of the ML work out there). But even with the freshest of venv creations, things still go remarkably wrong rather quick in my experience. My favorite is when someone, somewhere in the dependency tree forgets to lock their version, which ends up blossoming into a ticking time bomb before it abruptly stops working.

Hopefully, your experiences have been far more pleasant than mine.

load more comments (2 replies)
[–] Cornelius@lemmy.ml 9 points 1 year ago (1 children)

They're not difficult by any means.

But they are tedious when compared to other solutions.

[–] Scribbd@feddit.nl 4 points 1 year ago

If we talk about solutions: python has plenty. Which might be overwhelming to the user.

I use Direnv to manage my python projects. I just have to add layout pyenv 3.12.0 on top and it will create the virtual environment for me. And it will set my shell up to use that virtual environment as I enter that directory. And reset back to default when I leave the directory.

But you could use pipenv, poetry, pdm, conda, mamba for your environment management. Pip and python do not care.

load more comments (2 replies)
[–] Oha@lemmy.ohaa.xyz 26 points 1 year ago

npm is just plain up terrible. never worked for me first try without doing weird stuff

[–] operetingushisutemu@feddit.de 23 points 1 year ago* (last edited 1 year ago) (4 children)

I don't know what cargo is, but npm is the second worst package manager I've ever used after nuget.

[–] scorpionix@feddit.de 24 points 1 year ago

cargo is the package manager for the Rust language

[–] Lucky@lemmy.ml 10 points 1 year ago

I've never had an issue with nuget, at least since dotnet core. My experience has it far ahead of npm and pip

[–] backhdlp@lemmy.blahaj.zone 6 points 1 year ago

cargo is rust

[–] Pxtl@lemmy.ca 3 points 1 year ago* (last edited 1 year ago) (3 children)

what's wrong with nuget? I have to say I like the "I want latest" "no, all your dependencies are pinned you want to update latest you gotta decide to do it" workflow. I can think of some bad problems when you try to do fancy things with it but the basic case of "I just want to fetch my program's dependencies" it's fine.

load more comments (3 replies)
[–] gronjo45@lemm.ee 15 points 1 year ago (1 children)

Memes like this make me ever more confused about my own software work flow. I'm in engineering so you can already guess my coding classes were pretty surface level at least at my uni and CC

Conda is what I like to use for data science but I still barely understand how to maintain a package manager. Im lowkey a bot when it comes to using non-GUI programs and tbh that paradigm shift has been hard after 18 years of no CLI usage.

The memes are pretty educational though

[–] goatbeard@lemm.ee 27 points 1 year ago (2 children)

Try not to learn too much from memes, they're mostly wrong. Conda is good, if you're looking for something more modern (for Python) I'd suggest Poetry

[–] Pantoffel@feddit.de 5 points 1 year ago (2 children)

Tbh, I'm always ending up having issues using poetry and conda. I prefer using penv and pip.

load more comments (2 replies)
load more comments (1 replies)
[–] gerryflap@feddit.nl 14 points 1 year ago (2 children)

This is why I use poetry for python nowadays. Pip just feels like something ancient next to Cargo, Stack, Julia, npm, etc.

load more comments (2 replies)
[–] luky@infosec.pub 13 points 1 year ago

i will get hated for this but: cargo > composer > pip > npm

[–] Cwilliams 12 points 1 year ago (2 children)

What's so bad about pip? Imho, the venv thing is really nice

[–] ExLisper@linux.community 13 points 1 year ago (5 children)

vevn is not pip. The confusing set of different tools is part of the problem.

[–] danielquinn@lemmy.ca 19 points 1 year ago (1 children)

cough npm,yarn,grunt,esbuild,webpack,parcel,rollup,lasso,rollup,etc.,etc.cough

I'm not saying that Python's packaging ecosystem isn't complicated, but to paint JavaScript as anything other than nightmare fuel just isn't right.

[–] wraithcoop@lemmy.one 9 points 1 year ago (1 children)

I don't think that's a fair comparison, the only two libraries that are related to the actual packaging system in that list is yarn and NPM. The rest of them have to do with the complexities of actually having your code runnable in the maximum number of browsers without issue. If python was the browser scripting language, it'd likely have the same issue.

Is there a python package that transpiles and polyfills python3 to work in python 2? 2.7? 2.5?

Also, unrelated to your comment, a lot of people are dunking on npm for the black hole that is node modules (which is valid), but also saying it's not pip's fault a lot of packages don't work. It's not npm's fault the package maintainers are including all these dependencies, and there are some 0-dependency packages out there.

load more comments (1 replies)
[–] Cwilliams 5 points 1 year ago

Well I guess you could say the tools that integrate with pip are really good, then

load more comments (3 replies)
load more comments (1 replies)
[–] Ascyron@lemmy.one 6 points 1 year ago (2 children)

Bruh idk why the difference... Educate me?

[–] ExLisper@linux.community 7 points 1 year ago (1 children)

cargo just works, it's great and everyone loves it.

npm has a lot of issues but in general does the job. When docs say do 'npm install X' you do it and it works.

pip is a mess. In my experience doing 'pip install X' will maybe install something but it will not work because some dependencies will be screwed up. Using it to distribute software is pointless.

[–] krimson@feddit.nl 18 points 1 year ago (2 children)

I use pip extensively and have zero issues.

npm pulls in a million dependencies for even the simplest functionality.

[–] QuazarOmega@lemy.lol 5 points 1 year ago (1 children)

Is that really the fault of the package manager or is it of the libraries you decide to use?

[–] ninpnin@sopuli.xyz 5 points 1 year ago (1 children)

Fault of the libraries you decide to use, i.e. any and all node libraries

load more comments (1 replies)
[–] ExLisper@linux.community 3 points 1 year ago

It probably works for your own local project. After using it for couple of days to install some 3rd party tool my conclusion is that it has no idea about dependencies. It just downloads some dependencies in some random versions and than it never works. Completely useless.

[–] theFibonacciEffect@feddit.de 5 points 1 year ago (2 children)

Pip stores everything inside of some random txt file that doesn't differentiate between packages and dependencies.

[–] JakobDev@feddit.de 10 points 1 year ago (1 children)

Pip stores nothing in a text file

[–] theFibonacciEffect@feddit.de 7 points 1 year ago (2 children)

If you want to export your local environment, isn't usually a requirements.txt used?

[–] JakobDev@feddit.de 7 points 1 year ago (2 children)

Yes, but this file is created by you and not pip. It's not like package.json from npm. You don't even need to create this file.

load more comments (2 replies)
[–] farent@lemmy.scam-mail.me 6 points 1 year ago

Isn't it called a requirements.txt because it's used to export your project requirements (dependencies), not all packages installed in your local pip environment?

[–] SSUPII@sopuli.xyz 5 points 1 year ago (1 children)

Honestly its a simple and straightforward solution. What's wrong with it?

load more comments (1 replies)
[–] Swedneck@discuss.tchncs.de 6 points 1 year ago (1 children)

the only time i've had issues with pip is when using it to install the xonsh shell, but that's not really pip's fault since that's a very niche case and i wouldn't expect any language's package manager to handle installing something so fundamental anyways.

[–] NBJack@reddthat.com 3 points 1 year ago (2 children)

It's all fun and games until the wheel variant you need for your hardware acceleration package conflicts with that esoteric math library you planned on using.

load more comments (2 replies)
[–] QuazarOmega@lemy.lol 5 points 1 year ago

Fuck pip

all my homies use pdm

[–] pixelscript@lemmy.ml 3 points 1 year ago

Bottom should be Composer.

load more comments
view more: next ›