Avatar ·

Why you shouldn't use sudo pip?

📁 question, pip

Why shouldn't you use sudo pip? I don't fully understand this aspect. I was suggested to ask a separate question. It might also be useful for many other people to know.

Avatar ·

"

n

Why you should NOT use sudo pip install?

n

When installing a package, you are not just placing it in your file system, but also executing the setup.py script. Since anyone can upload a package to PyPI, you cannot be sure that setup.py does not contain code whose execution under the root user is undesirable/dangerous/unacceptable.

n

In terms of danger level, this is equivalent to executing a shell script "from the cloud" as superuser:

n
wget -O - http://example.com/some/unsafe/script.sh | bashn
n

What to do then?

n

Option 1

n

Except in cases where you absolutely need

Log in to leave an answer

Blogs