Sorry Python but it is what it is.
- LalSalaamComrade ( @velox_vulnus@lemmy.ml ) 87•8 months ago
- tias ( @tias@discuss.tchncs.de ) 37•1 year ago
That’s not a controversial opinion. I’d say it’s worse than pip. At least pip doesn’t put nag messages on the console or fill up your hard drive with half a gigabyte of small files. OP is confused.
- Hawk ( @Hawk@lemmy.dbzer0.com ) English9•1 year ago
npm is so good there are at least 3 alternatives and every package instructs on using a different one.
- gkd ( @gkd@lemmy.ml ) 1•11 months ago
About the only good thing about npm is that I can use one of the superior alternatives. Using npm is almost always a headache as soon as you start working with a decent number of packages.
In my experience npm is not great but it does work most of the time. I just tried installing bunch of stuff using pip and NONE of them worked. Python is backwards compatibility hell. Python 2 vs 3, dependencies missing, important libraries being forked and not working anymore. If the official installation instructions are ‘pip install X’ and it doesn’t work then what’s the point?
npm has A LOT of issues but generally when I do ‘npm i’ i installs things and they work.
But the main point is that cargo is just amazing :)
P.S. Never used ruby.
- redcalcium ( @redcalcium@lemmy.institute ) 6•1 year ago
Hmm, I personally haven’t seen that kind of issue myself though. I also tend to not use random packages from random authors though, so that might help.
- rothaine ( @rothaine@beehaw.org ) 5•1 year ago
Sorry but nah. My last job we had a couple different python microservices. There was pipenv, venv, virtualenv, poetry, Pipfile.lock, requirements.txt (which is only the top level???), just pure madness
Apparently all this shit is needed because python wants to install shit globally by default? Are you kidding?
Well, we also had a couple node microservices. Here’s how it went: npm install. Done.
Afraid you fucked something and want a clean environment? Here’s how you do it with node: delete
node_modules/
. Done.Want a clean python env? Uhhhhhhhh use docker I guess? Maybe try reinstalling Python using homebrew? (real actual answers from the python devs who set these up)
Well what’s currently installed?
ls node_modules
, or usenpm ls
if you want to be fancy.In python land? Uhhhhhh
Let’s update some dep–WHY AREN’T PYTHON PACKAGES USING SEMVER
So yeah, npm may do some stuff wrong, but it seems like it does way more shit right. Granted I didn’t really put in the effort to figure out all this python shit, but the people who did still didn’t have good answers. And npm is just straightforward and “works”.
“But JS projects pull in SOOOO many dependencies” Oh boohoo, you have a 1TB SSD anyway.
- rwhitisissle ( @rwhitisissle@lemmy.ml ) 14•1 year ago
Apparently all this shit is needed because python wants to install shit globally by default?
None of that was needed. It was just used because nobody at your company enforced a single standard for developing your product.
Afraid you fucked something and want a clean environment? Here’s how you do it with node: delete node_modules/. Done.
rm -rf venv/. Done.
Want a clean python env? Uhhhhhhhh use docker I guess?
python -m venv venv
Well what’s currently installed? ls node_modules, or use npm ls if you want to be fancy. In python land? Uhhhhhh
pip freeze. pip list if you want it formatted.
Let’s update some dep–WHY AREN’T PYTHON PACKAGES USING SEMVER
Janky, legacy python packages will have random versioning schemes. If a dependency you’re using doesn’t follow semver I would question why you’re using it and seek out an actively maintained alternative.
Im honestly surprised someone using Python professionally appears to not know anything about how pip/venv work.
The points you think you are making here are just very clearly showing that you need to rtfm…
- rothaine ( @rothaine@beehaw.org ) 1•11 months ago
More like rtfms. I really didn’t feel like learning 20 different tools for repos my team didn’t touch very often.
- CapeWearingAeroplane ( @CapeWearingAeroplane@sopuli.xyz ) 3•11 months ago
I really don’t see the hassle… just pick one (e.g. pip/venv) and learn it in like half a day. It took college student me literally a couple hours to figure out how I could distribute a package to my peers that included compiled C++ code using pypi. The hardest part was figuring out how to cross compile the C++ lib. If you think it’s that hard to understand I really don’t know what to tell you…
- rothaine ( @rothaine@beehaw.org ) 1•11 months ago
Sure, for a new project. But when inheriting code I’m not in a position to pick.
The point is that the state of python package managers is a hot fucking mess compared to npm. Claiming that “npm is just as bad” (or worse) honestly seems ridiculous to me.
(And isn’t pip/venv the one the
requirements.txt
one? Completely flat, no way to discern the difference between direct dependencies and sub-dependencies? No hashes? Sucks when it’s time for updating? Yeah no thanks, I’d like a proper lock file. Which is probably why there are a dozen other tools.)
- felbane ( @felbane@lemmy.ml ) 38•1 year ago
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.
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 ( @GBU_28@lemm.ee ) English4•1 year ago
Why not read the official python docs?
- NBJack ( @NBJack@reddthat.com ) 4•1 year ago
Hahaha!..
Oh shit, you’re serious.
- GBU_28 ( @GBU_28@lemm.ee ) English3•1 year ago
They pretty simply describe how to handle a venv, pip, reqs, etc.
- NBJack ( @NBJack@reddthat.com ) 4•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.
- jjjalljs ( @jjjalljs@ttrpg.network ) 3•1 year ago
If you’re using a manually managed venv, you need to remember to activate it, or to use the appropriate Python.
That really doesn’t seem like a big ask.
I’ve been using python professionally for like 10 years and package management hasn’t really been a big problem.
If you’re doing professional work, you should probably be using docker or something anyway. Working on the host machine is just asking for “it works on my machine what do you mean it doesn’t work in production?” issues.
No, actually most devs don’t use docker like that. Not java devs, not JS devs, not rust devs. That is because maven, npm and cargo manage dependencies per project. You use it for python exactly because pip does it the wrong way and python has big compatibility issues.
- Cornelius ( @Cornelius@lemmy.ml ) 9•1 year ago
They’re not difficult by any means.
But they are tedious when compared to other solutions.
- Scribbd ( @Scribbd@feddit.nl ) 4•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.
- barsoap ( @barsoap@lemm.ee ) 3•1 year ago
The only time I ever interacted with python packaging was when packaging for nixos. And I can tell you that the whole ecosystem is nuts. You have like ten package managers each with thirty different ways to do things, none of which specify dependencies in a way that can be resolved without manual input because y’all have such glorious ideas as implementing the same interface in different packages and giving each the same name and such. Oh and don’t get me started on
setup.py
making http requests. I have to agree, I maintain and develop packages in fortrat/C/C++ that use Python as a user interface, and in my experience pip just works.
You only need to throw together a ≈30 line
setup.py
and a 5 line bash script and then you never have to think about it again.
- ɐɥO ( @Oha@lemmy.ohaa.xyz ) 26•1 year ago
npm is just plain up terrible. never worked for me first try without doing weird stuff
- operetingushisutemu ( @operetingushisutemu@feddit.de ) 23•1 year ago
I don’t know what cargo is, but npm is the second worst package manager I’ve ever used after nuget.
- scorpionix ( @scorpionix@feddit.de ) 24•1 year ago
cargo is the package manager for the Rust language
- Lucky ( @Lucky@lemmy.ml ) 10•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
- Miku Luna \ she/it ( @backhdlp@lemmy.blahaj.zone ) 6•1 year ago
cargo is rust
- Pxtl ( @Pxtl@lemmy.ca ) English3•1 year ago
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.
- Lucky ( @Lucky@lemmy.ml ) 1•1 year ago
I’m guessing they only used it 10 years ago when it was very rough around the edges. It didn’t integrate well with the old .NET Framework because it conflicted with how web.config managed dependencies and poor integration with VS. It was quite bad back then… but so was .NET Framework in general. Then they rebuilt from the ground up with dotnet core and it’s been rock solid since
Or they just hate Microsoft, which is a common motif to shit on anything Microsoft does regardless of the actual product.
- Pxtl ( @Pxtl@lemmy.ca ) English2•1 year ago
Imho the VS integration has always been good, it’s the web config that’s always been a trash fire, and that’s not new.
- Lucky ( @Lucky@lemmy.ml ) 1•1 year ago
The project I’m on right now originally had the nuget.exe saved in source because they had to manually run it through build scripts, it wasn’t built in to VS until VS2012
- gronjo45 ( @gronjo45@lemm.ee ) 15•1 year ago
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 ( @goatbeard@lemm.ee ) 27•1 year ago
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 ( @Pantoffel@feddit.de ) 5•1 year ago
Tbh, I’m always ending up having issues using poetry and conda. I prefer using penv and pip.
- mog77a ( @mog77a@lemmy.ml ) English2•1 year ago
100% this. I remember really really trying to get the hang of them and eventually just giving up and doing it manually every time. I somehow always eventually mess something up or god forbid someone who isn’t me messes it up and I end up spending 4 hours dependency hunting. Venv and pip while still annoying are at least reliable and dead simple to use.
However, a container is now my preferred way of sharing software for at least the past 6 years.
- Pantoffel ( @Pantoffel@feddit.de ) 1•1 year ago
Yup. A container i slow to rebuild, but at least the most robust. This is my preferred way to share python code when there are system dependencies involved.
- gronjo45 ( @gronjo45@lemm.ee ) 2•1 year ago
Never have heard of Poetry, but I’ll check it out tonight! I pretty much exclusively coded in Python and Julia up until I got out of uni. I learned after a couple of months of insanity swapping kernels, init systems, distributions and learning everything about file systems only leads to further insanity and productivity hindrance.
Something something recommending someone who doesn’t know what a shell is to use emacs and make a Lua/Neovim config. Thanks for the tip!
- gerryflap ( @gerryflap@feddit.nl ) 14•1 year ago
This is why I use poetry for python nowadays. Pip just feels like something ancient next to Cargo, Stack, Julia, npm, etc.
- someacnt ( @someacnt@sopuli.xyz ) 2•1 year ago
Stack?
- gerryflap ( @gerryflap@feddit.nl ) 2•1 year ago
Used for Haskell development: https://docs.haskellstack.org/en/stable/
- luky ( @luky@infosec.pub ) 13•1 year ago
i will get hated for this but: cargo > composer > pip > npm
- Cwilliams ( @Cwilliams@beehaw.org ) 12•1 year ago
What’s so bad about pip? Imho, the venv thing is really nice
vevn is not pip. The confusing set of different tools is part of the problem.
- Daniel Quinn ( @danielquinn@lemmy.ca ) English19•1 year ago
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 ( @wraithcoop@lemmy.one ) 9•1 year ago
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.
- AVincentInSpace ( @AVincentInSpace@pawb.social ) 2•11 months ago
Is there a python 3 package that polyfills to Python 2?
Plenty of 'em. You ever heard of the
six
library?
- Cwilliams ( @Cwilliams@beehaw.org ) 5•1 year ago
Well I guess you could say the tools that integrate with pip are really good, then
- Fushuan [he/him] ( @fushuan@lemm.ee ) English2•1 year ago
It’s not that confusing. There’s like 5 main different tools in total, what are you going to code if you can’t even set up the workspace? That’s much simpler than an installation that depends on cuda or spark, and those only require setting up environment variables after installation anyway.
As a programmer you’ll encounter several redundant libraries and tools in your life where each has an edge in some use cases and you’ll learn to use most to be able to adapt to the different projects you encounter, python’s package manager tools are simply one of those.
Of course there are more redundant tools. It doesn’t make pip suck any less though.
- 𝕨𝕒𝕤𝕒𝕓𝕚 ( @wasabi@feddit.de ) 1•1 year ago
Just use poetry then
- christophski ( @christophski@feddit.uk ) English2•1 year ago
I genuinely don’t get the hate for pip, been using it for 5 years and never had an issue
- Ascyron ( @Ascyron@lemmy.one ) English6•1 year ago
Bruh idk why the difference… Educate me?
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 ( @krimson@feddit.nl ) 18•1 year ago
I use pip extensively and have zero issues.
npm pulls in a million dependencies for even the simplest functionality.
- QuazarOmega ( @QuazarOmega@lemy.lol ) 5•1 year ago
Is that really the fault of the package manager or is it of the libraries you decide to use?
- ninpnin ( @ninpnin@sopuli.xyz ) 5•1 year ago
Fault of the libraries you decide to use, i.e. any and all node libraries
- QuazarOmega ( @QuazarOmega@lemy.lol ) 1•1 year ago
Well if that’s the case, can’t argue with that lol
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 ( @theFibonacciEffect@feddit.de ) 5•1 year ago
Pip stores everything inside of some random txt file that doesn’t differentiate between packages and dependencies.
- JakobDev ( @JakobDev@feddit.de ) 10•1 year ago
Pip stores nothing in a text file
- theFibonacciEffect ( @theFibonacciEffect@feddit.de ) 7•1 year ago
If you want to export your local environment, isn’t usually a requirements.txt used?
- JakobDev ( @JakobDev@feddit.de ) 7•1 year ago
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.
- theFibonacciEffect ( @theFibonacciEffect@feddit.de ) 2•1 year ago
Well if the file would be created by hand, that’s very cumbersome.
But what is sometimes done to create it automatically is using
pip freeze > requirements. txt
inside your virtual environment.
You said I don’t need to create this file? How else will I distribute my environment so that it can be easily used? There are a lot of other standard, like setup.py etc, so it’s only one possibility. But the fact that there are multiple competing standard shows that how pip handles this is kinds bad.
- JakobDev ( @JakobDev@feddit.de ) English1•1 year ago
If you try to keep your depencies low, it’s not very cumbersome. I usually do that.
A setup.py/pyproject.toml can replace requirements. txt, but it is for creating packages and does way more than just installing dependencies, so they are not really competing.
For scripts which have just 1 or 2 packges as depencies it’s also usuall to just tell people to run pip install .
- Farent ( @farent@lemmy.scam-mail.me ) 6•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 ( @SSUPII@sopuli.xyz ) 5•1 year ago
Honestly its a simple and straightforward solution. What’s wrong with it?
- theFibonacciEffect ( @theFibonacciEffect@feddit.de ) 1•1 year ago
If newer versions are released and dependencies change you would still install the old dependencies. And if the dependencies are not stored you can’t reproduce the exact same environment.
- Swedneck ( @Swedneck@discuss.tchncs.de ) 6•1 year ago
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 ( @NBJack@reddthat.com ) 3•1 year ago
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.
- neosheo ( @neosheo@beehaw.org ) English1•1 year ago
Isn’t this why you use venv?
- Skadabucci ( @Skadabucci@beehaw.org ) 1•1 year ago
This isn’t a pip issue though. Either these packages work together and the packaging is wrong, or they don’t work together.
- QuazarOmega ( @QuazarOmega@lemy.lol ) 5•1 year ago
Fuck pip
all my homies use pdm
- dan ( @dan@upvote.au ) 3•1 year ago
NuGet (for C# / .NET) is far better than npm.
- Ineocla ( @Ineocla@lemmy.ml ) 1•1 year ago
And it has a cool name
- pixelscript ( @pixelscript@lemmy.ml ) English3•1 year ago
Bottom should be Composer.
- Andrew ( @Andrew15_5@mander.xyz ) 2•1 year ago
npm bad, pnpm good.
- spiderplant ( @spiderplant@lemm.ee ) 1•1 year ago
Bun best
- boratul ( @boratul@lemmy.ml ) 2•1 year ago
this is more abt programming languages than packages managers
- someacnt ( @someacnt@sopuli.xyz ) 1•1 year ago
Which allows me to bash python endlessly >.>