1

I am trying to install the PyGreSQL package into Python 2.7. I am running 32-bit Python on a 64-bit Windows 7 machine. The installer I am using is the file PyGreSQL-4.1.1.win32-py2.7.exe from here.

The installation of PyGreSQL purportedly proceeds successfully, but upon attempting to import the module in python, with

import pg

I receive the following error:

Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "pg.py", line 31, in <module>
        from _pg import *
ImportError: DLL load failed: %1 is not a valid Win32 application.

My PostgreSQL installation is 64-bit, if that complicates things. Anyone know how to resolve this?

  • The correct download path is from the Python Package Index (PyPi) PyGreSQL-4.1 – gene Mar 18 '15 at 17:35
  • The DLL load error is what you see if you try to load a 32-bit package from 64-bit Python (or vice versa). Check again with import platform; print(platform.architecture()[0]). – Mike T Mar 19 '15 at 2:32
  • @MikeT 32 bit it says. – Blazinator Mar 19 '15 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.