简体   繁体   中英

You have held broken packages - Postgres gem for rails

So when ever I attempt to do bundle install I am told to make sure the pg gem is installed successfully, so when I do the gem install pg vx.xx I get:

Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /home/adam/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***

So then I do:

sudo apt-get install libpq-dev

But I get

The following packages have unmet dependencies:
 libpq-dev : Depends: libpq5 (= 9.1.14-0ubuntu0.12.04) but 9.3.5-1.pgdg12.4+1 is to be installed
E: Unable to correct problems, you have held broken packages.

So I have 9.1 of everything else installed from postgres and pgadmin, and I have any 9.3 repos disabled. I have done a sudo apt-get update but I think the error is pretty obvious. So How do I make it not try and install 9.3.5 .... and go with 9.1.14?

I've just run into this very problem. I found the solution here: http://blog.andrewbeacock.com/2007/03/how-to-install-specific-version-of.html

Essentially:

$: apt-get install libpq5=9.1.14-0ubuntu0.12.04
$: apt-get install libpq-dev=9.1.14-0ubuntu0.12.04
$: apt-get install postgresql-server-dev-9.1

I got the same issue, after trying multiple solutions my problem

The following packages have unmet dependencies:

but it is not going to be installed
           Depends: libwxbase3.0-0v5 (>= 3.0.4+dfsg)  
but it is not installable
           Depends: ```libwxgtk3.0-0v5 (>= 3.0.4+dfsg)  
but it is not installable
 E: Unable to correct problems, you have held broken packages.

The above resolved by uninstalling Postgresql and pgAdmin and downloading it from the official website

https://www.postgresql.org/

https://www.pgadmin.org/download/pgadmin-4-apt/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM