Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing psycopg2 in cygwin

Tags:

python

django

I'm trying to install psycopg2 in cygwin but have not succeeded yet. The error is:-

Gaurav@gauravpc ~/FieldAgentWeb/FieldAgentWeb
$ easy_install psycopg2
Searching for psycopg2
Reading http://pypi.python.org/simple/psycopg2/
Reading http://initd.org/psycopg/
Reading http://initd.org/projects/psycopg2
Best match: psycopg2 2.4.2
Downloading http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.2.tar.gz
Processing psycopg2-2.4.2.tar.gz
Running psycopg2-2.4.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-QBYpxH
/psycopg2-2.4.2/egg-dist-tmp-gcLa5F
Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

    python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.
error: Directory not empty <built-in function rmdir> /tmp/easy_install-QBYpxH/ps
ycopg2-2.4.2/tests

After that i was trying to get d pg_config file, but couldn't find it on the net.

like image 254
himanshu Avatar asked Oct 03 '11 04:10

himanshu


People also ask

How do I install psycopg2 on Windows 10?

The previous command may not work if you have both Python versions 2 and 3 on your computer. In this case, try "pip3 install psycopg2" or “ python -m pip install psycopg2 “. Wait for the installation to terminate successfully. It is now installed on your Windows machine.

Is psycopg2 a package?

The psycopg2 package is the current mature implementation of the adapter: it is a C extension and as such it is only compatible with CPython.


2 Answers

I just managed to install psycopg2 today without installing the windows PostgreSQL (in my case the db is already set up in another server, I just need to connect to it with a python package which depends on psycopg2, so having the complete installation it was not necessary for me).

Following pg_config executable not found , from the cygwin setup I installed postgresql-devel AND libpq-dev ( those should be the necessary ones, for the record I installed also a lot of other packages relative to postgresql like postgresql-client, postgresql-plpython and libpq5).

After that I could run succesfully pip install psycopg2

like image 185
lib Avatar answered Oct 05 '22 06:10

lib


pg_config is part of your PostgreSQL installation. It's in the bin directory of your local installation (e.g. C:\Program Files (x86)\PostgreSQL\9.0\bin). Add that directory to your search path and try to build again.

like image 42
Pablo Avatar answered Oct 05 '22 04:10

Pablo