2

I already have the postgresql of latest version(14.0-1.pgdg21.04+1).

I want to setup dev environment for psycopg2(https://github.com/psycopg/psycopg2/) library locally and it requires libpq-dev for that.

Running sudo apt-get install libpq-dev gives following error

The following packages have unmet dependencies: libpq-dev : Depends: libpq5 (= 13.4-1) but 14.0-1.pgdg21.04+1 is to be installed E: Unable to correct problems, you have held broken packages.

It's because ubuntu repository(https://packages.ubuntu.com/impish/libpq-dev) doesn't have the latest version yet.

But I've found that debian sid repository have the latest version libpq-dev (14.0-1)

I can download the .deb file and dpkg install it but the downside is I can't upgrade it. Also, I don't want to add debian in my sources list, because it might mess a lot of other things.

So, what's the easiest way to download this package?

Krishna
  • 338

2 Answers2

2

For me running the following code solved the problem

sudo apt-get install libpq-dev
Charles
  • 21
0

Just install the required version of libpq5 and reinstall libpq-dev:

sudo apt-get install libpq5=13.4-1
sudo apt-get install libpq-dev

I suppose for psycopg2 you also need:

sudo apt-get install python3-dev
  • Thanks for you answer. Welcome to Ask Ubuntu. I had made it clear in the title and description as well that I need to install the latest version(14.0-1). Downgrading is obviously a solution but in my case not helpful. – Krishna Nov 03 '21 at 11:22