I'm trying to install PostGIS but with no luck. I've installed PostgreSQL 11 x64 and PostGIS Bundle 2.5.2 x64 and when trying to create an extension in pgAdmin I get:

ERROR: could not load library "C:/Program Files/PostgreSQL/11/lib/rtpostgis-2.5.dll": %1 is not a valid Win32 application. SQL state: XX000

I have Window 10 Pro x64. I have no idea where does this 32 error comes from. The installers come in x64 version so this should be available and I remember having this working correctly on my previous laptop.

I've also tried with PostgreSQL 10 x64 and PostGIS Bundle 2.4.4 x64 with the exact same outcome.

Have anyone experienced this or have an idea on what else to check? I'm stuck.

  • which installer are you using?
    – Ian Turton
    Commented Aug 20, 2019 at 10:00
  • I've tried with postgresql-10.10-1-windows-x64.exe and postgresql-11.5-1-windows-x64.exe taken from enterprisedb.com/downloads/postgres-postgresql-downloads
    – Monika
    Commented Aug 20, 2019 at 10:07
  • There must be some component that is compiled for Win32 playing a role. I would install once again into some other directory than "Program Files" and make sure that there are no remains of PostgreSQL and PostGIS in Program Files. The version of pgadmin should not have an effect but check that as well. If it still fails ask somebody to try installation with the same packages on another computer. Packaging errors do happen.
    – user30184
    Commented Aug 21, 2019 at 6:50
  • I'm afraid still no luck. I've uninstalled and searched for any leftover files (including temp) and removed those too. Rebooted the machine, installed PostgreSQL outside of Program Files, got the separate installer for PostGIS (all x64). Still same error when trying to create an extension. I've tried several packages, including the those tested successfully on other machines so it's definitely something specific to mine... I have QGIS installed with some PostGIS files, but all x64 as well
    – Monika
    Commented Aug 21, 2019 at 15:42

2 Answers 2


This error can occur when you have a mixed installations of x86 and x64.

Did you ever installed x86 versions of PostgreSQL and/or PostGIS before? try removing all versions and install from link here again.

  • This is a new machine, and a first attempt to install it. I don't have any x86 version and have reinstalled x64 already more than once so this will not make any difference... Would it use any other already existing components on the machine that could be causing this? I haven't set up the machine initially so perhaps something else is in conflict?
    – Monika
    Commented Aug 20, 2019 at 15:20
  • delete postgis extension from control panel and try installing from Here. Also check file permissions. Commented Aug 21, 2019 at 8:41
  • No luck. I'm a local administrator, run the installer additionally as an admin, unlocked the installers before running them, no difference
    – Monika
    Commented Aug 21, 2019 at 15:43

Turned out this issue required copying the dll files from postgisgui folder into the main bin folder of PostgreSQL installation directory. Works for me as expected now.

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.