16

I can not install libpq-dev for postgresql, i tried

sudo apt-get install libpq-dev

and output

Building dependency tree       
Reading state information... Done
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:
 libpq-dev : Depends: libpq5 (= 9.3.9-0ubuntu0.14.04) but 9.4.4-1.pgdg14.04+1 is to be installed
E: Unable to correct problems, you have held broken packages.

how to fix this problem?

3 Answers3

30

Problem is solved!

I solved this with remove libpq5 :

sudo apt-get remove libpq5
sudo apt-get install libpq-dev
3

To fix this, I had to add postgresql's repo:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get -y update
sudo apt-get remove libpq5
sudo apt-get install libpq-dev

Zendel
  • 179
2

The problem can be solved via following steps :

sudo apt-get update
sudo apt-get remove libpq5
sudo apt-get install libpq-dev