Ubuntu – Can’t install libpng-dev


I use Ubuntu 15.10 64-bit. When I run

sudo apt-get install libpng-dev

the console prints

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libpng12-dev' instead of 'libpng-dev'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libpng12-dev : Depends: libpng12-0 (= 1.2.51-0ubuntu3) but 1.2.51-0ubuntu3.15.10.2 is to be installed
E: Unable to correct problems, you have held broken packages.

At first I tried installing libpng-dev in the Software Center, but it crashed when it tried installing libpng-dev. Then I googled, tried

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -f libpng-dev

but this didn't help. Maybe I should just reinstall Ubuntu? I'd have no problem with that, would just take me about an hour.

$ apt-cache policy libpng12-dev


  Installed: (none)
  Candidate: 1.2.51-0ubuntu3
  Version table:
     1.2.51-0ubuntu3 0
        500 http://de.archive.ubuntu.com/ubuntu/ wily/main amd64 Packages
$ apt-cache policy libpng12-0


  Installed: 1.2.51-0ubuntu3.15.10.2
  Candidate: 1.2.51-0ubuntu3.15.10.2
  Version table:
 *** 1.2.51-0ubuntu3.15.10.2 0
        100 /var/lib/dpkg/status
     1.2.51-0ubuntu3 0
        500 http://de.archive.ubuntu.com/ubuntu/ wily/main amd64 Packages

Best Answer

You've manually installed some other build of libpng12-0 it appears. You need to sudo apt-get install --reinstall libpng12-0=1.2.51-0ubuntu3 and then you will be able to install libpng-dev.