2

In attempting to install a python module I got the error code:

ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.7/dist-packages/twilio' Consider using the --user option or check the permissions.

I searched for the error message, and found several solutions to try. One of them is to just use sudo, although this is marked as "not recommended".

Why isn't it a good idea to use sudo to install a package in a directory my user doesn't own?

partial_mask
  • 77
  • 3
  • 12
  • 4
    It's a bad idea to install packages that haven't been tested as part of your OS vendor's QA process in systemwide directories in the first place. Install them in a virtualenv under your home directory, and you don't risk changing/breaking the behavior of other users on the system, tools provided by your OS vendor, etc. – Charles Duffy Jun 18 '19 at 13:34
  • (Even better is to use a tool like [Nix](https://nixos.org/nix/), which keeps each package ("derivation") in a read-only store hashed by its inputs with references to the explicit hashes of the components it depends on -- so you can have N different versions of twilio, or Python, or libc, or whatever, used by different software, and each program gets only the exact version it wants as a dependency; whereas programs and users haven't asked for that dependency don't see the change at all). – Charles Duffy Jun 18 '19 at 13:37

0 Answers0