The other day I tried to install a package from AUR using Yay helper program. The package I tried to install has many Python dependencies. Unfortunately, I couldn't install it and Yay kept throwing the following error. I thought the problem would be solved if I remove the conflicting packages. But, I don't want to break the system. Here is the output error message when I tried to install a program from AUR:
error: failed to commit transaction (conflicting files) python-tabulate: /usr/bin/tabulate exists in filesystem python-tabulate: /usr/lib/python3.6/site-packages/__pycache__/tabulate.cpython-36.pyc exists in filesystem python-tabulate: /usr/lib/python3.6/site-packages/tabulate.py exists in filesystem Errors occurred, no packages were upgraded. :: Building torrench package(s)... ==> Making package: torrench 1.0.56-1 (Mon Oct 23 15:46:37 IST 2017) ==> Checking runtime dependencies... ==> Installing missing dependencies... error: target not found: python-tabulate ==> ERROR: 'pacman' failed to install missing dependencies.
As you can see in the above output, the following three packages were the ones that causing the problem.
Solve "ERROR: 'pacman' failed to install missing dependencies" In Arch Linux
To me, deleting the problematic packages fixed the problem. However, it is always recommend to check the problematic files are not owned by some other packages. Because If it is owned by some other program, deleting them is bad idea. So, you need to find those conflicting files are not owned by any other packages. The pacman command can easily find out if a file is owned by other packages in your Arch Linux system.
In my case, I checked whether the above mentioned files are owned some other packages as shown below.
$ sudo pacman -Qo /usr/bin/tabulate
error: No package owns /usr/bin/tabulate
$ sudo pacman -Qo /usr/lib/python3.6/site-packages/__pycache__/tabulate.cpython-36.pyc
error: No package owns /usr/lib/python3.6/site-packages/__pycache__/tabulate.cpython-36.pyc
$ sudo pacman -Qo /usr/lib/python3.6/site-packages/tabulate.py
error: No package owns /usr/lib/python3.6/site-packages/tabulate.py
As you can see, all of the above commands showed me that those files are not owned by any packages. So, I simply deleted them one by one.
$ sudo rm /usr/bin/tabulate
$ sudo rm /usr/lib/python3.6/site-packages/__pycache__/tabulate.cpython-36.pyc
$ sudo rm /usr/lib/python3.6/site-packages/tabulate.py
Done! Now, I can be able to install all packages with Python dependencies. For safety a precaution, backup those conflicting files before deleting them. You can restore them just in case if there are any problems after deleting them.