After upgrade of pip
version to 10.0.0
, installation with pip fails when there is a version conflict with a distutils installed package:
Cannot uninstall '***'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
This could be for PyYAML, pyOpenSSL, urllib3, chardet
and so on.
I try to manage this issue by uninstalling corresponding packages such as;
python-yaml python-openssl python-urllib3 python-chardet
with apt-get
(Ubuntu) and then install those libraries again with pip
However as it might be expected removal by apt-get
also results removal of many dependent additional system packages which seems not a good practice:
The following packages will be REMOVED:
apt-xapian-index cloud-init landscape-client-ui-install oneconf python-aptdaemon python-aptdaemon.gtk3widgets python-chardet python-cupshelpers python-debian python-openssl python-pip python-requests python-ubuntu-sso-client python-urllib3 python-yaml sessioninstaller software-center ssh-import-id system-config-printer-common system-config-printer-gnome system-config-printer-udev ubuntu-desktop ubuntu-release-upgrader-gtk ubuntu-sso-client ubuntu-sso-client-qt update-manager update-notifier update-notifier-common
I also don't want to downgrade pip
to an older version.
So what is the best practice to handle conflicting distutils libraries with pip?
Ps: I supposed pip
is for easy management of Python
libraries but this incident makes it enough complicated.
pip
andnpm
) conflict with OS package managers (apt
andrpm
) and there are many ways to resolve conflicts. For some packages you simple remove files/directories manually. For some you remove them withapt
and reinstall withpip
. – phd Apr 19 '18 at 15:04