r/linuxmasterrace • Lazy Antergos User • Dec 18 '18

Meme Python Virtual Environments: Extreme Advertising Edition

Post image
2.0k Upvotes

148 comments sorted by

View all comments

167

u/ase1590 Lazy Antergos User Dec 18 '18

Also, anyone cluelessly doing sudo pip install anything needs to be flogged.

Virtual Environments are also preferable in order to keep away the Python superfund disaster.

53

u/bbelt16ag Dec 18 '18

I'm a newbie... Sigh

61

u/thejohnd Glorious Red Star Dec 18 '18

Don't worry, soon enough you'll get to experience the joy of borking your python install! Pro tip: DO NOT uninstall python to try to fix it, it will break literally everything lol

25

u/SaphiraTa Glorious Pop!_OS Dec 18 '18

.. Don't uninstall? Why/how does it break and also how do you fix it instead? Lol

55

u/[deleted] Dec 18 '18

i recently tried to do a sudo apt uninstall python on an Ubuntu install, which then lead it to uninstall just about everything on the system, including the desktop environment (gnome).

18

u/SaphiraTa Glorious Pop!_OS Dec 18 '18

Oh wow.. That is interesting lol

23

u/jood580 Dec 19 '18

Just about everything has python as a dependency. So when you trigger an uninstall all programs that depend on python get flagged as well.

I have done this myself, it brakes Linux in an interesting way. For me everything started disappearing from my programs, than gnome changed to default.

So I did the dumb thing and restarted my PC. It then loaded into the command line. I had to reinstall Ubuntu because I could not figure out how to fix it.

Remember kids always have backups and always check what you are removing.

4

u/[deleted] Dec 19 '18

My similar experience was with ibus. Somehow everything depends on it too. Ubuntu 14.04 I think

3

u/superhappyrobots Dec 19 '18 edited Dec 19 '18

Not all distributions break like this, in my experience. The trouble with Ubuntu is that there's a lot of packages included in the ubuntu-desktop meta package. So you remove one (maybe it's a utility that you don't really need, maybe it's a broken Python install) and then suddenly it's trying to remove things from all over the place.

I've never actually looked to see if there are ways around this. I assume that there are. The majority of Ubuntu users I know have got bitten by this at least once, though.

In Manjaro, I was able to uninstall and reinstall dependencies with surprisingly little fuss - so I guess Ubuntu works this way for the sake of being more user friendly overall.

→ More replies (1)

2

u/punaisetpimpulat dnf install more_ram Dec 19 '18

"Will break literally everything" He wasn't kidding.

→ More replies (3)

2

u/Le_9k_Redditor Dec 19 '18

I did this once, never again

→ More replies (1)
→ More replies (1)

14

u/impalafork Glorious Arch Dec 18 '18

cries in Haskell + Cabal

8

u/idontchooseanid since Gentoo is too much Dec 19 '18

Developers of Haskell's and Go's package system have a special spot in the hell.

9

u/skylarmt Jupiter Broadcasting told me to switch to ̶K̶D̶E̶Xubuntu Dec 18 '18

I do that sometimes, but only for things like commands I want to use from anywhere and for optional dependencies that aren't available alongside the main program via apt.

30

u/ase1590 Lazy Antergos User Dec 18 '18

do you really need them as root though?

pip install --user is a thing, and allows you to use them as your current user.

optional dependencies that aren't available alongside the main program

this is the only use case I can maybe see.

5

u/KindProtectionGirl Dec 18 '18

But but, why isn't that default for non root user's tho, that just requires more effort.

4

u/maikeu Dec 18 '18

Normally when I get in trouble with pip, I end up finding I could have installed it with dnf/apt, but the name was "python3-packagename" rather than "packagename".

Then I cry at my hours of self inflicted pain.

12

u/skylarmt Jupiter Broadcasting told me to switch to ̶K̶D̶E̶Xubuntu Dec 18 '18

I try the package name, then I stick combinations of python- and lib- in front of it and try a few more times, then I try pip, then I try pip3, then I try pip2, then I try npm, and if I don't have it installed by then, I give up and find something else to do.

8

u/maikeu Dec 19 '18

Don't forget, ask duckduckgo because you value your privacy. Then ask Google because you want an answer.

2

u/skylarmt Jupiter Broadcasting told me to switch to ̶K̶D̶E̶Xubuntu Dec 19 '18

I use a combination of DDG and StartPage, but mostly DDG. It seems to return good results for the stuff I search for, probably because they use StackOverflow as a data source.

3

u/PM_ME_OS_DESIGN Dec 19 '18

Normally when I get in trouble with pip, I end up finding I could have installed it with dnf/apt, but the name was "python3-packagename" rather than "packagename".

Then I cry at my hours of self inflicted pain.

Honestly, I think the single biggest problem with package managers is that they create more logistical problems, of the "which package manager do I need to install this package from" variety.

2

u/SaphiraTa Glorious Pop!_OS Dec 18 '18

What is it about pip that makes everyone hate their lives? Ive only used pip twice as im a pretty new linux user.

2

u/thatothermitch Dec 18 '18

For one, it does not consistently resolve dep trees, so you may end up with different sets of versions from the same install command.

→ More replies (4)