Web lists-archives.com

Re: Removing old python packages installed with pip

Eike Lantzsch <zp6cge@xxxxxxx> writes:

> On Friday, December 1, 2017 3:24:47 PM -03 Urs Thuermann wrote:
> > On a machine running Debian stretch I have installed python3, which is
> > currently python3.5.  Nothing of python3.4 is present.
> > 
> > But in /usr/local/lib/python3.4/dist-packages/ a number of packages is
> > still installed.  Probably, these have been installed using pip3 when
> > python3.4 was current.
> > 
> > Now, it seems pip3 isn't able to remove packages from that old
> > directory.  Is it safe to just rm -r /usr/local/lib/python3.4?

> If those packages were installed together with the Debian system then 
> deinstall with aptitude or apt remove.

No, as I said, it was (most probably) installed using pip3 when
python3.4 was current in Debian.  Debian packagement doesn't know
about it, so cannot uninstall it.

> If you mix two different package installers the consequence is that one does 
> not know about the other and they can interfere with each other.

No, nothing is mixed.  pip installs in /usr/local, Debian packagement
installs in /usr.

But pip3 formerly installed in /usr/local/lib/python3.4 but now seems
not to know about anymore.  Now it installs in /usr/local/lib/python3.5.
Therefore, pip3 doesn't list and cannot uninstall python packages from
the older /usr/local/lib/python3.4.  Also, python3, which is 3.5
currently, seems not to search that old directory.

I am almost sure that just removing it will be fine, but I wanted to
make sure, that no file of pip3 e.g. in /var or elsewhere still refers
to /usr/local/lib/python3.4.  That's why I asked here.

> On Debian always install packages the "Debian way".

There are Python packages like theano and keras that are not in
Debian.  They can only be installed completely manually or using
pip3.  In both cases they go to /usr/local, of course.