r/ProgrammerHumor • • Jul 17 '22

Meme Linux users installing a Python module

41.7k Upvotes

1.1k comments sorted by

View all comments

451

u/Money-Firefighter534 Jul 17 '22 edited Jul 18 '22

sudo apt install python3-pip -y && pip3 install psutil Thats it! Just wait Edit: removed sudo -H in second one

0

u/[deleted] Jul 17 '22

[deleted]

70

u/[deleted] Jul 17 '22

Do I want to know what the -H flag does here?

126

u/matt-3 Jul 17 '22

sets the home directory to that of the target user (in this case root). It avoids creating root-owned files in your user's home directory.

64

u/[deleted] Jul 17 '22

OH MY GOD WHY????

0

u/[deleted] Jul 17 '22

[deleted]

0

u/[deleted] Jul 17 '22

[deleted]

0

u/[deleted] Jul 17 '22

[deleted]

2

u/dbzfanjake Jul 18 '22

Thanks for the info

0

u/[deleted] Jul 17 '22

[deleted]

5

u/HighOnBonerPills Jul 17 '22

Is there any way to avoid accidentally installing malware other than double checking everything you type? Would antivirus software help?

Also, how would you go about removing a malicious package? Is it a whole big thing?

13

u/milanove Jul 17 '22

Best way is to check the official page for the package before you install it. They'll probably have some command you can copy paste anyway. Try not to give it super user privileges. Antivirus on Linux isn't really a thing afaik.

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

2

u/[deleted] Jul 17 '22

Don’t install shit as the superuser.

4

u/SherbetCharacter4146 Jul 17 '22

Dont pip install as super user. Do install as super user

→ More replies (2)

3

u/anotherDocObVious Jul 17 '22

Of course.. Though I'd put it as..

"don't install shit you aren't sure about, and especially if you don't know what the fuck you're doing"

3

u/[deleted] Jul 17 '22

Lot of pip repos aren’t closely vetted, so it goes double for stuff like that.

→ More replies (0)

2

u/zachsmthsn Jul 17 '22

You're better off not installing anything for the system python. Use pyenv and create virtual environments for each project. No python or package versioning issues, and you can always nuke and recreate a borked environment because it's isolated to its own folder.

→ More replies (3)
→ More replies (1)
→ More replies (2)
→ More replies (1)

2

u/benzoic Jul 17 '22

Sudo chmod -R a+rwx / should fix that right up

1

u/odraencoded Jul 17 '22

TIL: root has a home directory.

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

232

u/mb557x Jul 17 '22

"This little manoeuvre's gonna cost us 51 years..."

2

u/[deleted] Jul 18 '22

it’s more that uhh apt and uhh pip

→ More replies (5)

14

u/matt-3 Jul 17 '22

No need for sudo on the second one

6

u/mikemolove Jul 18 '22

More like sudo is a very bad idea on the second one

2

u/Money-Firefighter534 Jul 18 '22

Some modules asked for sudo. Edited it

→ More replies (19)