I am writing this because I am very confused about installing PostgreSQL 9.3 on my Ubuntu 14.04. First I need it for my Python/Django development, and I ran into the problem when I tried to install it. Now I have this error and it is driving me crazy:

The following packages have unmet dependencies:
postgresql-9.3 : Depends: postgresql-client-9.3 but it is not going to be installed
Depends: postgresql-common (>= 142~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have found some solutions online (How do I resolve unmet dependencies after adding a PPA?), and I did everything to the Preventive Measures part, because I have had some broken packages problem, and again after I had this error show to me again.

The second thing I have followed the official PostgreSQL installing tutorial (http://www.postgresql.org/download/linux/ubuntu/), and I have had duplicated repositories, but I have deleted them and I have added a fresh one but still this error.


You can install the package using.

make sure the repo sources are up to date

sudo apt-get update

To Install the package.

sudo apt-get install packagename

Once the package determines that you have some missing dependencies, run the following command to fix broken or missing dependencies.

sudo apt-get install -f

Above command will only download the missing dependencies if you have already installed the package.

  • 4
    Thank you, I thought it meant use sudo apt-get install -f packagename and was getting the same error. – Charles Clayton Jan 27 '16 at 5:15
  • 3
    This doesn't work with python2.7-minimal errors. – IgorGanapolsky Oct 26 '16 at 16:10
  • 2
    Doesn't work: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded – JBSnorro Jun 10 '20 at 10:34

I know I'm a bit late, but none of the above solutions worked for me. What really solved my problem was to use aptitude instead of apt-get. aptitude will suggest resolutions to the problem.

Simply run these:

sudo apt-get install aptitude

sudo aptitude install <package-name>

aptitude will suggest dependencies resolution for you e.g:

The following actions will resolve these dependencies:

Keep the following packages at their current version:
1)     libyaml-dev [Not Installed]                        

Accept this solution? [Y/n/q/? (n)

The following actions will resolve these dependencies:

Downgrade the following packages:                                
1)     libyaml-0-2 [0.1.4-3ubuntu3.1 (now) -> 0.1.4-3ubuntu3 (trusty)]

Accept this solution? [Y/n/q/?] (Y)

as discussed in this post.

  • 3
    This worked for me while the other answers didn't. Thanks! – aniztar Jun 18 '20 at 8:55

Sometimes the dependencies that need fixing are unrelated to the program you are trying to install. In my case it was giving off this error:

The following have unmet dependecies

shashlik : Depends: libc6-i386 but it is not going to be installed

Depends: lib32gcc1 but it is not going to be installed

Depends: lib32z1 but it is not going to be installed

It turned out that I had tried to install a program called "Shashlik" and the installation had failed. So I ran the code:

sudo apt-get --purge remove shashlik

And then I ran:

sudo apt install autoconf

This seemed to fix the error as my program then installed. I am not sure how much the second command helped but I put it there in case it was necessary for the solution to work.

  • how did you determine this was the issue? – kevinkayaks May 7 '19 at 20:16
  • At the risk of replying late, the error was given to me when I tried to install the package, I just had to read the error message. – Joel Winterton Apr 1 '20 at 16:09

Let me share with other people my experience with installing postgresql-9.3. First of all I have been struggling with this for about 4/5 days, and I finally manage to do it.

All went wrong with these nasty errors I have shared in my first post, as I have tried to google it and discover that people have more less the same error, or struggling to solve a similar one.

Long story short, you have a very nice answer here how to resolve unmet packages:

How do I resolve unmet dependencies after adding a PPA?

My mistake was that I have made duplicated repository, and the answer in this link solved that, this command sudo apt-get install -f just made another error, you must do this manually, at least I did it (read to the section Preventive Measures, but you could read to the end, it is an imba post).

Second I manage to google this post from official PostgreSQL page http://www.postgresql.org/message-id/20140327084212.GA12703@msgid.df7cb.de (this is the error people usually have when they are struggling with installation of postgresql), this led me to
https://wiki.postgresql.org/wiki/Apt, this is the proper way for adding PostgreSQL Packages to your system, just read it and do it step by step.

Third step are series of commands provided in the @vembutech post:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install postgresql-9.3 postgresql-contrib-9.3

Try by installing the with below command.

sudo apt-get install postgresql-common=151.pgdg12.4+1

sudo apt-get install postgresql-9.3 postgresql-contrib-9.3
  • 1
    "E: Version '151.pgdg12.4+1' for 'postgresql-common' was not found", error again... – copser Dec 19 '14 at 12:44
  • I manage to do it, I run second command and finally I did it, @vembutech <3 – copser Dec 19 '14 at 12:49

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