[Tutor] pip issue

Mats Wichmann mats at wichmann.us
Thu May 2 20:51:48 EDT 2019


On 5/2/19 6:14 PM, Cameron Simpson wrote:
> On 02May2019 17:24, Anil Duggirala <anilduggirala at fastmail.fm> wrote:
>> I executed the pip3 install --user -r
>> contrib/requirements/requirements.txt (I actually did sudo before that).
> 
> Please don't use sudo for this. The notion "install" does not imply
> being root.

> The whole point of --user is to install packages in your personal
> account without troubling with the system packages. Doing that as root
> only installs the packages for root, generally a useless thing as you
> shouldn't be running normal stuff as root.
> 
> Just do pip3 as yourself.

also, despite the large volume of old text that says otherwise, it's
better not to invoke pip as a command, but as a module. Thus, instead of

pip3 install --user blah

do:

python3 -m pip install --user blah

assuming you wanted it to work for "python3". the latter way makes sure
the package ends up in a place that matches the Python you're going to
use - and you are going to use this code from another Python program,
no?  (that change is not going to fix your problem, it's just general
advice). Most Linux systems these days have several Python versions, and
the more you use Python the more likely it is you got something that set
up another Python version (virtualenv, bundled Python, etc). Mac users
often have two: the system one, and the one you actually use for your
own work.  Even Windows users end up with several Pythons, e.g. one you
installed, one that got installed with Visual Studio, etc.



More information about the Tutor mailing list