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
  • Look in /etc/apt/preferences or /etc/apt/preferences.d/ to see if you have any package pinning going on. That's what this looks like. Also, have you turned on backports or added other apt repos? – Wren T. Jan 12 '16 at 21:09
  • Nope, /etc/apt/preferences.d/ is empty. I'll try rebooting. Update: no success with rebooting. – user492501 Jan 12 '16 at 21:18
  • I didn't turn on backports to my knowledge. But I have once run sudo add-apt-repository "deb archive.ubuntu.com/ubuntu $(lsb_release -sc) universe". – user492501 Jan 12 '16 at 21:23
  • 1
    What does apt-cache policy libpng12-dev say? – Florian Diesch Jan 12 '16 at 21:30
  • $ apt-cache policy libpng12-dev libpng12-dev: Installed: (none) Candidate: 1.2.51-0ubuntu3 Version table: 1.2.51-0ubuntu3 0 500 de.archive.ubuntu.com/ubuntu wily/main amd64 Packages ......... I've added this to the question to get lines. – user492501 Jan 12 '16 at 21:31

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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.