This project is archived and is in readonly mode.

#139 ✓invalid

Installation Error of Psycopg2 on windows 7

Reported by chandramouli | November 15th, 2012 @ 11:40 AM

I was trying to iinstall Psycopg2 on win 7 (64 - bit, installed python2.7 32 bit)

  1. Installtion stops saying Python is not found in registry.
  2. Have tried giving .Zip and extracted all files, placed in C:/Python27/
    getting error "%1 is not a standard win32 command" on invoking psycopg2

any help would be highly appreciated as am stuck on this for a while.

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo November 15th, 2012 @ 12:31 PM

    Hi, not getting your config. Win7 64 bit and you have Python 2.7 32 bit installed. Are you trying to install Psycopg 32 or 64 bit? I assume it must be 32 but it seems you are installing the 64 bit. Please clarify.

  • chandramouli

    chandramouli November 15th, 2012 @ 12:39 PM

    Hi Daniele ,

    I was trying out with both 64 as well as 32 bit versions..

    Both installers fail saying "Python2.7 is not found in the registry"

    Then I have unzipped them manually and placed them in C:\Python27 (my python instal dir)
    if i try to invoke psycopg2 it gives error "%1 is not win32 recognized command"

  • Daniele Varrazzo

    Daniele Varrazzo November 15th, 2012 @ 01:46 PM

    psycopg is not to be invoked: it's not a program, it's a library.

    For me it just sounds like a screwed up Python installation. I'll ask Jason to take a look at this ticket: I can't help you further with Windows.

  • chandramouli

    chandramouli November 15th, 2012 @ 04:25 PM

    thanks for you time Daniele,

    yeah invoking it is a dumb (desperate)attempt
    am using python code which has import Psycopg2 statement in it, which is failing..

  • Daniele Varrazzo

    Daniele Varrazzo November 15th, 2012 @ 04:35 PM

    I've asked Jason to take a look at your case, but if it is possible, I'd suggest you to uninstall all the Python installation instances from your machine and try re-installing python again.

    Unpacking the .exe (which you have already discovered it is a .zip) and copying manually the psycopg2 directory and its contained file _psycopg.dll into a PYTHONPATH directory should work as well, provided Python is correctly installed and the 32/64 bit option and Python version match.

  • Jason Erickson

    Jason Erickson November 15th, 2012 @ 08:50 PM

    A few questions come to mind:

    • Is your python 2.7 installed from the installation package at
    • Are you using virtualenv?
    • Are you using python from a 3rd party package (ie, like ArcGIS, ABACUS, etc)?

    The installation sets up the registry keys in one of the two locations for your environment:


    Being that the psycopg2 installation is not finding the installation keys leads me to believe that there is something unusually with your setup.

    From your description (32bit Python 2.7), you would need the following psycopg2 package:

    Can you remove all instances of psycopg2 that you installed by hand and start the python interpreter?:


    And issue the following in the python interpreter:

      import psycopg2

    We should see the following error (We want it to fail at this point)

      ImportError: No module named psycopg2

    If we don't, it means that python is attempting to install psycopg2 from another location and you will have to remove those files. What I am looking for is that python is not grabbing psycopg2 from somewhere else, and that we are starting from a clean slate.

    Once we are at this point, we can extract the files by hand. Using a program like 7zip, open up the above psycopg2 installation package. Go into the PLATLIB directory. At this point, there will be a psycopg2 directory and a psycopg2-2.4.5-py2.7.egg-info file. The "psycopg2" directory should be extracted and placed in the "C:\Python27\lib\site-packages" directory.

    Start the python interpreter again and issue the import psycopg2, this time it should be successful with importing the module. (Fingers crossed).

    If you are still having problems, issue the following commands at the python interpreter and let me know the output:

      import sys
  • Daniele Varrazzo

    Daniele Varrazzo November 24th, 2012 @ 10:58 PM

    • State changed from “new” to “invalid”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="">the new tracker</a>.
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins