1

Problem

I can't install libpq-dev in ubuntu 20.04.2

I ran this command:

$ sudo apt-get update

$ sudo apt-get install libpq-dev

then I got errors bellow.

Reading package lists... Done
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 (= 12.7-0ubuntu0.20.04.1) but 13.3-1.pgdg20.04 + 1 is to be installed E: Unable to correct problems, you have held broken packages.

Then I try to install the library directly with this command:

$  sudo apt-get install libpq5=12.7-0ubuntu0.20.04.2

I got this error:

Reading package list ... Done
Creating dependency tree
Reading status information ... Done
E: The version «12.7-0ubuntu0.20.04.2» was not found for «libpq5»

Status

Ubuntu version

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:    20.04
Codename:   focal

Kernel version

$ uname -a
Linux IdeaPad-S340-15API 5.8.0-55-generic #62~20.04.1-Ubuntu SMP Wed Jun 2 08:55:04 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Updated

$ apt-cache policy libpq-dev libpq5
libpq-dev:
  Installed: (none)
  Candidate: 12.7-0ubuntu0.20.04.1
  Version table:
     12.7-0ubuntu0.20.04.1 500
        500 http://security.ubuntu.com/ubuntu focal-security / main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu focal-updates / main amd64 Packages
     12.2-4 500
        500 http://archive.ubuntu.com/ubuntu focal / main amd64 Packages
libpq5:
  Installed: 13.3-1.pgdg20.04 + 1
  Candidate: 13.3-1.pgdg20.04 + 1
  Version table:
 *** 13.3-1.pgdg20.04 + 1 500
        500 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 / main amd64 Packages
        100 / var / lib / dpkg / status
     13.2-1.pgdg20.04 + 1 500
        500 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 / main amd64 Packages
     13.1-1.pgdg20.04 + 1 500
        500 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 / main amd64 Packages
     13.0-1.pgdg20.04 + 1 500
        500 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 / main amd64 Packages
     12.7-0ubuntu0.20.04.1 500
        500 http://security.ubuntu.com/ubuntu focal-security / main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu focal-updates / main amd64 Packages
     12.4-1.pgdg20.04 + 1 500
        500 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 / main amd64 Packages
     12.3-1.pgdg20.04 + 1 500
        500 https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 / main amd64 Packages
     12.2-4 500
        500 http://archive.ubuntu.com/ubuntu focal / main amd64 Packages
Developer
  • 111
  • On your second attempt, looks like you used the wrong version number: Your output says 12.7-0ubuntu0.20.04.1, but you said that you input 12.7-0ubuntu0.20.04.2 – user535733 Jun 15 '21 at 23:58
  • 1
    The problem with your first attempt is that you have unwisely added a non-Ubuntu source that is providing packages incompatible with your release of Ubuntu (that's what you have requested an impossible situation means). You will continue to encounter issues like these until you stop using that source and purge the packages that came from it. – user535733 Jun 16 '21 at 00:00
  • 1
    Does this answer your question? How do I restore the default repositories? . You probably miss focal-updates. Please add output of apt-cache policy libpq-dev libpq5 to find3rd repository. – N0rbert Jun 16 '21 at 06:54

0 Answers0