Running Create Extension postgis gives ERROR could not open extension control file?
I have installed PostgreSQL 9.x and PostGIS 1.5/2.0 several times and have never had this problem.
I just got a new CentOS 6.3 server up and running and and I have Postgres 9.3 functioning as expected. I have run
yum install postgis2_93
and I can see the files in
however, when I run
CREATE EXTENSION postgis;
ERROR: could not open extension control file "/usr/pgsql-9.3/share/extension/postgis.control": No such file or directory
What am I missing?
What you're missing is 'postgis.control' :) The question is 'why' or 'where'. First, see if you even have a copy by running 'find /usr -name postgis.control'. If you don't, then it's a packaging problem with the brand new postgis2_93 package that needs to be fixed.
Oh, you can see the files (including 'postgis.control'?) share/contrib, but from the error message pgsql is looking in share/extension. There might have been a change in default extension location from 9.2 to 9.3 that the packager missed.
@PaulRamsey - I ran `find /usr -name postgis.control` and it is not present. I can see some files in share/contrib; however, postgis.control is not among them... what do you suggest I do? wait for a fix, make my own, something else?
@PaulRamsey - I just verified that `postgis-2.1.so` is present in `/lib` does this mean I can just make my own postgis.control file?
If you can find a postgis.sql file, you can run that into your database (and the spatial_ref_sys.sql file) to manually spatialize your database. Report the missing control file to the packager, that's a big problem.
I just had the same problem on Ubuntu Server 14.04. I installed the
postgisextension from the official Ubuntu repositories using
apt-get install postgis.
find /usr -name postgis.controldidn't return any results.
The reason was
extension/postgis.controlwasn't installed because postgis-scripts wasn't.
$ aptitude search postgis i libpostgis-java - Geographic objects support for PostgreSQL -- JDBC support i postgis - Geographic objects support for PostgreSQL p postgis:i386 - Geographic objects support for PostgreSQL i postgis-doc - Geographic objects support for PostgreSQL -- documentation i postgresql-9.3-postgis-2.1 - Geographic objects support for PostgreSQL 9.3 p postgresql-9.3-postgis-2.1:i386 - Geographic objects support for PostgreSQL 9.3 i postgresql-9.3-postgis-2.1-scripts - PostGIS for PostgreSQL 9.3 -- scripts -- dummy package i postgresql-9.3-postgis-scripts - Geographic objects support for PostgreSQL 9.3 -- scripts
The solution is to install it.
On debian-like distros:
apt-get install postgis*
The aptitude package manager will automatically determine the correct package versions to install. The postgis-doc will be installed too.
Like some people noticed in comments, the
postgis*is not required because it installs some packages not strictly required to just get it to work.
The required packages are
postgresql-9.x-postgis-scriptsmeta packages. They select the correct real version for your system. So the commands to install the required packages are
$ sudo apt-get install postgis postgresql-9.3-postgis-scripts
postgresql-9.5so the command becomes:
$ sudo apt-get install postgis postgresql-9.5-postgis-scripts
You can check the success of the operation by running the following command:
find /usr -name postgis.control
On my server, it now returns:
You can now enable the extension on any database on your postgres server:
- connect to your db with superuser (postgres by default)
CREATE EXTENSION postgis;
Your public schema now contains all postgis objects and functions.
...never mind! Solved it in Windows by reinstalling PostGIS via StackBuilder
Thanks this fixed my Ubuntu problem! The "postgis*" gets a bunch of stuff you don't need. I think "apt-get install postgis postgresql-9.3-postgis-2.1" is sufficient.
You're probably right. In my case, a full install was preferable but it doesn't the rule.
Another source which caused the problem could be the missing PostGIS bundle, this can be defined in install menu or in your case afterwards. Therefor, open windows start, head to PostgreSQL an start the Application Stack Builder. Then select PostgreSQL, with that possible applications are loaded. For the PostGIS bundle you just need to install the extension suitable to your operating system (32- or 64bit), simply direct to Spatial Extensions.
After all here the recommended steps:
- start Application Stack Builder
- Direct to Spatial Extensions
- Install PostGIS bundle
Now you can add the extension with
CREATE EXTENSION postgis;in your SQL Query.
I encountered the same problem, I think the problem is that the package postgis2_93 is not installed in the expected place as postgresql would expect. You can try using another repo, which might give you the correct place. Or you can search to add extensions manually by specifying the place. In my case, the file is in /usr/pgsql-9.4/
I had my worst nightmare while installing Postgis 2.X on SLES 12 SP1. which doesnt have compatible package in zypper repo
Here is how is resolved it on my Postgres server instance running 9.4.X
Prerequsite packages which i have installed prior to PostGis based on the errors
- Proj 4 Download source cold, Build --> make install
- install Gdal andjibson by adding zypper repo zypper addrepo http://download.opensuse.org/repositories/Application:Geo/SLE_12_SP1_Backports/Application:Geo.repo
- zypper install gdal gdal-devel libjson-c-devel libjson
Download postgis source code (http://download.osgeo.org/postgis/source/postgis-2.3.0rc1.tar.gz)
Go to Post gis folder ./configure --with-pgconfig=/usr/lib/postgresql94/bin/pg_config --with-geosconfig=/usr/local/bin/geos-config make make install
now if you goto postgress and create extension postgis; will work
Important while configuring you should specify pg-config path and geosconfig path and You SHOULD NOT include "without Raster" as RASTER plays main role in creating the postgis extension
For me, using Fedora 25 and pg 9.5, it worked when I did the following changes:
Install yum postgis package
$ yum install postgis2_95
Download the postgis scripts .deb package
Extract it and copy the directories 'contrib' and 'extension' in extracted usr/share/postgresql/9.5 to the the same path in your pgsql (maybe changing permissions to).
Restart the server
In my case (Linux Mint 18.1 Serena) I had to remove
postgisnewly installed from default repository.
sudo apt remove postgis* sudo apt remove postgresql*
And install version 9.6 from PosgreSQL repository:
sudo apt install postgresql-9.6 postgresql-9.6-postgis-2.3 postgresql-9.6-postgis-2.3-scripts postgresql-contrib-9.6
I'm not sure, version has anything to do with missing
postgis.controlfile. But I wanted 9.6 version anyway.