Using sudo with pip3?

jim jf_byrnes at
Sat Jan 7 23:26:47 EST 2017

On 01/07/2017 08:42 PM, Cameron Simpson wrote:
> On 07Jan2017 19:45, jim <jf_byrnes at> wrote:
>> On 01/07/2017 05:58 PM, Clint Moyer wrote:
>>> So to minimize your issues with installing Python packages, take the
>>> path of least resistance and install through your system repo. And use
>>> Python2 or Python3 explicitly to avoid conflicts.
>> As I mentioned in another post, most of the more popular modules I had
>> installed on my old system using pip are available in the repository
>> and I will use the repository to install them on the new system. I now
>> understand that using sudo is a bad idea.
> Cool.
>> One question from the earlier post that did not get answered concerned
>> upgrading a repository installed module with pip.
> I would recommend not. As soon as you get there:
>  - if the vendor updates it, use apt-get (I know this doesn't fit your
>    situation with Ubuntu 16.04 LTS)
>  - if you want a more modern version, now is the time to use virtualenv
> The thing about LTS is that the vendor guarentees its stability. If you
> upgrade the vendor installed package using /usr/bin/pip (or pip3) as
> root, you're replacing the vendor supplied module with a newer one,
> which may break vendor supplied packages which use that module expected
> the _old_ behaviour.
> So endeavour to leave the vendor suppplied stuff entirely alone except
> for apt-get style updates.
> Instead, make a virtualenv an upgrade it with a newer package.
>> To get started on the new system I installed pip3 from the repository.
>> The first time I used it to install a module it said a newer version
>> was available and gave the command to update it. What are the
>> consequences of using pip to upgrade repository installed modules?
> In theory, if the newer version of the module installs a breaking change
> it can break things in the system which might use that module and expect
> its old behaviour. Also, _sometimes_, vendors supply patches versions of
> packages, possibly including python modules. If they're
> modified/patched, there is probably a reason. You'd be undoing that patch.
>> I ask because 16.04 is LTS and won't be getting version upgrades
>> unless they are security related. Also pandas is in the repositories
>> but the module pandas-datareader, which I may need to use, is not.
> Again: make a virtualenv as yourself.
> Its pip can be run as yourself, therefore cannot accidentally modify
> system module. It's pip can freely upgrade a older module. If you
> install a module _not_ supplied by the vendor, the virtualenv pip can
> freely do that, and _also_ upgrade a required module should that be
> required (PyPI package definitions let a module specify required
> revisions of other modules it may use).
> Cheers,
> Cameron Simpson <cs at>

You've convinced me.  I will have to buckle down and figure out to use 
virtualenv/venv. I see Chris recommends venv. I read through PEP405 and 
this link I don't pretend 
to fully understand it all but it does seem to make a good case for 
using venv over virtualenv.

thanks,  Jim

More information about the Python-list mailing list