Error: failed to commit transaction (conflicting files) python-cairo

I am updating the system as usual sudo pacman -Syu and got this

[sudo] password for yuanhao: 
:: Synchronising package databases...
 endeavouros is up to date
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 g14 is up to date
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Package (6)         Old Version     New Version     Net Change

core/glib2          2.74.2-2        2.74.3-1          0.00 MiB
core/linux          6.0.10.arch2-1  6.0.11.arch1-1   -0.17 MiB
core/linux-headers  6.0.10.arch2-1  6.0.11.arch1-1    0.02 MiB
extra/python-cairo  1.23.0-1        1.23.0-2          0.00 MiB
core/sqlite         3.40.0-1        3.40.0-2          0.00 MiB
core/usbutils       015-1           015-2             0.00 MiB

Total Installed Size:  340.40 MiB
Net Upgrade Size:       -0.14 MiB

:: Proceed with installation? [Y/n] 
(6/6) checking keys in keyring                                               [-------------------------------------------] 100%
(6/6) checking package integrity                                             [-------------------------------------------] 100%
(6/6) loading package files                                                  [-------------------------------------------] 100%
(6/6) checking for file conflicts                                            [-------------------------------------------] 100%
error: failed to commit transaction (conflicting files)
python-cairo: /usr/lib/python3.10/site-packages/cairo/__pycache__/__init__.cpython-310.pyc exists in filesystem
Errors occurred, no packages were upgraded.

I think (although not entirely sure) this is because I use the package python-pip before and use pip to install the packages, but I had uninstalled pip long time ago, so this might be some packages installed by pip before I remove python-pip.

Now I reinstall pip and trying to remove the pycairo package, as pip list gives me some packages including that:

Package      Version
------------ -----------------
attrs        22.1.0
btrfsutil    6.0.2
cffi         1.15.1
colorama     0.4.6
cryptography 38.0.4
cupshelpers  1.0
defusedxml   0.7.1
future       0.18.2
Glances      3.3.0
lensfun      0.3.3
nftables     0.1
numpy        1.23.5
packaging    21.3
pip          22.3.1
ply          3.11
psutil       5.9.4
pyaml        21.10.1
pycairo      1.23.0
pycparser    2.21
pycups       2.0.1
pycurl       7.45.1
PyGObject    3.42.2
pyparsing    3.0.9
PyQt5        5.15.7
PyQt5-sip    12.11.0
PyYAML       6.0
Reflector    2021.11.20.2.41.3
shtab        1.5.8
TBB          0.2
team         1.0
termcolor    2.1.1
tldr         3.1.0
wheel        0.38.4

however I got this error

> bsh > pip uninstall pycairo 
Found existing installation: pycairo 1.23.0
ERROR: Cannot uninstall 'pycairo'. 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.

How can I solve my problem?
And, If i want to prevent this, how can I remove all packages installed by pip and should I?

This isn’t an issue with pip

1 Like