I am using Ubuntu 22.04. Somehow, whenever I try to install a package in Ubuntu, I get this error
libjpeg-dev : Depends: libjpeg62-turbo-dev (>= 1:1.5.2-2+deb10u1) but it is not going to be installed
So I tried sudo apt -f install
But I got
dpkg: error processing archive /var/cache/apt/archives/libjpeg62-turbo-dev_1%3a1.5.2-2+deb10u1_amd64.deb (--unpack):
trying to overwrite '/usr/include/jerror.h', which is also in package libjpeg-turbo8-dev:amd64 2.1.2-0ubuntu1
I tried to remove libjpeg8, but got an error
sudo apt-get remove libjpeg-turbo8-dev
The following packages have unmet dependencies:
libjpeg-dev : Depends: libjpeg62-turbo-dev (>= 1:1.5.2-2+deb10u1) but it is not going to be installed
I tried to install libjpeg62
sudo apt-get install libjpeg62-turbo-dev
dpkg: error processing archive /var/cache/apt/archives/libjpeg62-turbo-dev_1%3a1.5.2-2+deb10u1_amd64.deb (--unpack):
trying to overwrite '/usr/include/jerror.h', which is also in package libjpeg-turbo8-dev:amd64 2.1.2-0ubuntu1
I tried to install aptitude because it is said to be able to resolve package conflict, but got the same error
sudo apt-get install aptitude
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
aptitude : Depends: aptitude-common (= 0.8.13-3ubuntu1) but it is not going to be installed
Depends: libcwidget4 (>= 0.5.18-1) but it is not going to be installed
Depends: libxapian30 (>= 1.4.17~) but it is not going to be installed
libjpeg-dev : Depends: libjpeg62-turbo-dev (>= 1:1.5.2-2+deb10u1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Output when I tried to run dpkg --configure
sudo dpkg --configure -a && sudo apt clean
dpkg: dependency problems prevent configuration of libjpeg-dev:
libjpeg-dev depends on libjpeg62-turbo-dev (>= 1:1.5.2-2+deb10u1); however:
Package libjpeg62-turbo-dev:amd64 is not installed.
dpkg: error processing package libjpeg-dev (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
libjpeg-dev
Basically, in my system now there is a conflict in libjpeg8 and libjpeg62 which can't be fixed. What can I do to resolve this?