Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostGIS -Ubuntu Installation Error asking for dependencies

I am new to postgre and Ubuntu. I am running a VM with Ubuntu 14.04 LTS Trusty. I am trying install PostgreSql9.4 Database and PostGIS 2.1.Here are the commands I ran on the Ubuntu machine:

sudo apt-get install wget ca-certificates 
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt trusty-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-9.4-postgis-2.1 pgadmin3 postgresql-contrib

However I am getting the following error.

The following packages have unmet dependencies:
 pgadmin3 : Depends: libwxbase3.0-0 (>= 3.0.0) but it is not installable
            Depends: libwxgtk3.0-0 (>= 3.0.0) but it is not installable
            Recommends: pgagent but it is not going to be installed
 postgresql-9.4-postgis-2.1 : Depends: libgdal1h (>= 1.9.0) but it is not installable
                              Depends: libgeos-c1 (>= 3.4.2) but it is not installable
                              Depends: liblwgeom-2.1.5 (>= 2.1.2) but it is not going to be installed
                              Depends: libproj0 (>= 4.8.0-1) but it is not installable
E: Unable to correct problems, you have held broken packages.

I searched several places and saw many responses, but none of them work for me. I also tried the PostgreSQL9.3 and couldn't succeed as well.Thanks in advance for your help. Thanks

like image 733
bogeyman Avatar asked Mar 25 '15 03:03

bogeyman


3 Answers

You likely have a higher version candidate of the packages on postgresql's repository then in your official distribution (hence the unmet dependencies). A possible solution is to install the same package from your distro channels by checking if they are available as candidates (apt-cache policy) and choosing specific versions to install (also for dependencies).

On my system it looks as follows:

The following packages have unmet dependencies:
 pgadmin3 : Depends: libwxbase3.0-0 (>= 3.0.2) but it is not installable
            Depends: libwxgtk3.0-0 (>= 3.0.2) but it is not installable
            Recommends: pgagent but it is not going to be installed

apt-cache policy pgadmin3
pgadmin3:
  Installed: (none)
  Candidate: 1.20.0-1.pgdg70+1
  Version table:
     1.20.0-1.pgdg70+1 0
        500 http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg/main amd64 Packages
     1.14.2-2 0
        500 http://ftp5.gwdg.de/pub/linux/debian/debian/ wheezy/main amd64 Packages

You then want to install the lower version with:

$ sudo apt-get install pgadmin3=1.14.2-2 pgadmin3-data=1.14.2-2
like image 141
a1an Avatar answered Oct 29 '22 14:10

a1an


For adding PostGIS, linking an answer I just posted to Ubuntu: https://askubuntu.com/questions/621383/installing-postgis-on-ubuntu-15-04

Quick recap: I'm also new to Ubuntu but my understanding is a) postgresql-9.4 does not yet have postgis built for ubuntu and b) there's a version compatibility issue between ubuntugis and trusty, steps I used to fix were:

  1. uncheck or remove ubuntugis from /etc/apt/sources.list ("other software" tab)

  2. install with sudo apt-get install postgresql-9.3-postgis-2.1 (note: use apt-cache search postgresql-9 to see what versions of postgis are available)

  3. confirm install with psql, in psql run CREATE EXTENSION postgis;, and confirm added with \dx

like image 2
claytonrsh Avatar answered Oct 29 '22 15:10

claytonrsh


This is what I did to finally install pgadmin3:

First I checked the available version on the repository:

apt-cache policy pgadmin3

Then installed that version (may change in time, use the proper version shown by the previous command):

sudo apt-get install pgadmin3=1.22.2-1 pgadmin-data=1.22.2-1
like image 1
Paco Abato Avatar answered Oct 29 '22 15:10

Paco Abato