This most likely happened because you were using two different package managers (dpkg
or its frontend apt-get
, and pip
itself) on the same prefix (/usr
). I assume that either
- a recent
apt-get upgrade
updating some dependencies, but some other files that were installed by pip
didn't get updated because dpkg
and apt-get
simply didn't know about them OR
- you removed a package with
apt-get remove
, and as apt-get
wasn't aware of anything using this package (as the other package was installed by pip
and thus not in the dpkg
database), it didn't warn you about breaking other packages.
Without knowing which packages were installed with which package manager, I cannot give you any really specific advice how to repair your system, only general advice:
Don't use multiple different package managers. Only ever use one package manager for a given (sub-)tree of your filesystem, or you will get inconsistencies and/or conflicts. Debian's package manager for the /usr
tree is called dpkg
, and without calling it noone should ever touch /usr
.
It certainly doesn't help that most python-related people you'll encounter try to push pip, even going as far as telling you to sudo pip install
; don't. There are distro packages containing python stuff for a reason. Also see this related question on AskUbuntu and this answer on StackOverflow.
You can try to repair the mess by installing a fresh pip with
apt-get purge python-pip python3-pip
apt-get install python-pip python3-pip
however there may be files left behind that might interfere, which dpkg
doesn't know about as they were installed by pip
. The sure-fire way would be checking all files under /usr/lib/python*
whether they belong to a debian package, and if not, delete them without exception.
Again, only use dpkg
and its frontend tools like apt-get
, aptitude
, synaptic
, ... to modify /usr
. If you need to install anything system-wide that's not available as .deb
package, either create a package and install it with dpkg
, or install it under /usr/local
.
which pip
to your question. Also, did you install 3.5 viaapt-get
or was it compiled? – Nasir Riley Nov 4 '18 at 2:11/usr/bin
, are is there more than onepython
andpip
such aspython
andpython3
andpip
andpip3
? – Nasir Riley Nov 4 '18 at 2:21