I followed Nominatim Tutorial to install PostGIS and after that I can't access PostGIS at all I already trying reinstalling and installing everything over and over again with no success. Everytime I try the function

SELECT postgis_lib_version()

I get the error:

ERROR:  could not load library "/usr/lib/postgresql/9.3/lib/postgis-2.1.so": /usr/lib/postgresql/9.3/lib/postgis-2.1.so: undefined symbol: HeapTupleHeaderGetDatum

My Ubuntu is

Distributor ID: Ubuntu Description: Ubuntu 12.04.4 LTS Release: 12.04 Codename: precise

My Postgresql is 9.3 with PostGIS 9.1

The Libs I was instructed to install is:

apt-get install build-essential libxml2-dev libgeos-dev libpq-dev libbz2-dev libtool automake libproj-dev apt-get install gcc proj-bin libgeos-c1 git osmosis apt-get install php5 php-pear php5-pgsql php5-json php-db
apt-get install postgresql postgis postgresql-contrib postgresql-9.1-postgis postgresql-server-dev-9.1

In the tutorial here

1 Answer 1


When I looked at your question I thought you might have a conflict between postgresql versions and postgis versions. That made me reach for the Postgresql to PostGIS supported versions matrix. But that is not the problem. The problem is with your apt-get line

apt-get install postgresql postgis postgresql-contrib postgresql-9.1-postgis postgresql-server-dev-9.1

You are mixing several versions of postgresql and postgis.

  1. Try uninstalling the exact same list of postgresql and postgis install names that you have listed above.
  2. Use apt-get install postgresql postgis postgresql-contrib postgresql-server-dev

That should install all the current versions of postgresql, postgis, the postgresql contrib applications, and any required development libraries for compiling programs.

What is happening now is that there are pointers in library files that are not in the same place as expected by, say psql. The first version of the executable in your path is mixing with the first pgsql library in your library path. This is not a winning combination for you. For example, the postgresql-9.1-postgis package may be mixing with the postgis package. Let's say the postgresql-9.1-postgis package installs version 1.5 of postgis. Let's also say that the postgis package installs version 2.1 of postgis. This will fail. These are not compatible. Moreover, you have the same issue with postgresql package and postgresql-server-dev-9.1 package.

  • Hi Greg, well, I wrote in the wrong way, I was actually installing the Postgresql 9.3 but you were right, I guess it was conflicted libs. Well, What I did after reading your comments was reinstalling but the it didn't solve the problem, I also unninstalled all the libs but still, no go... what solved was running apt-get update and apt-get upgrade Commented Nov 7, 2014 at 11:35
  • The way the packaging is done for each Linux distribution varies. I am guessing that the package without the version is the older 8.x version of Postgres. Likewise, the Postgis version without the version is pre 2.x. That way the distro can support users that are not able to push on to the newer releases of Postgres/PostGIS. If the answer met your needs, then please remember to mark the answer as the solution.
    – Greg
    Commented Nov 7, 2014 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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