[GIS] Cannot create postgis extension to postgres database even though postgis is installed

postgis

What I do:

Windows 7, Pgadmin, I select my database, go to extensions, select "New Extension", select "postgis" from List. Then, I get: "An error has appeared: Error: could not load library: C:/Program Files/PostgreSQL/9.4./lib/postgis-2.1.dll". However, when I look into this folder, the file definitely exists.

What can be the problem?

Best Answer

That error is caused by a dependency library issues. Is often caused by

1) when you installed not all files were overwritten. You should have gotten an error during install, that some files in use, if that is the case

2) You installed the wrong PostGIS version. E.g. you installed 64-bit version when you are running PostgreSQL 32-bit or 32-bit when you are on PostgreSQL 64-bit. Which version did you install? Did you get it from stackbuilder

3) I screwed up on packaging and missed adding a file you need. Likely culprit is libxml2-2.dll (verify you have that). EDB sometimes changes the name so I may have missed packaging thinking they included it already.

4) Your installed teh wrong PostGIS e.g. installed 2.1.8 for 9.3 instead of 9.4 for example, you have a really old micro version of PostgresQL

verify with

SELECT version();

You should be running 9.4.4 or 9.4.5 to be safe.

Related Question