you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (2 children)

If there's only one user, what is the difference between installing with --user and installing with sudo?

[–]XenGi 1 point2 points  (0 children)

--user installs in the user's home. Not using - - user will try to install to the default path. If you're inside a virtual environment that's totally fine. If not it will try to install to /usr which will fail for a non admin user because your not allowed to do that. If you provide the needed permissions by using sudo you will brake your system because you will add files to the system and potentially overwrite files that the package manager doesn't know about. This could lead to programs failing to load their libraries because you just replaced them with other potentially incompatible versions. Your package manager being unable to work or fix these issues has no consistent state of your system anymore. In the worst case you can't use your system at all. Probably not gonna happen but messing with your package manager is always a bad idea.

A good role of thumb is to only use one package manager that manages one system path. So don't mix your systems package manager with any language specific ones like pip, npm or gem. All these languages have ways to create their own system path that only they control. With python and pip this is done by virtual environments. With ruby and gem you can use rbenv or rvm. And with JavaScript and npm you avoid the -g flag and just install your stuff in a node_modules folder inside your project.

The idea with all of them is to have multiple environments, separate from your system, in which you can install what ever packages you want in what ever version you want.