This question is not directly related with Django, but with Python.
I have installed "virtualenv" to have a virtual environment. Now I
need to instal "psycopg2" in my virtual environment, but I have not
successfully installed.
My steps:
[quote]
pip install
http://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
[/quote]
And I got this message with an error:
[quote]
Downloading/unpacking
http://pypi.python.org/packages/source/p/psycopg2/psycopg2
-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
Downloading psycopg2-2.4.tar.gz (607Kb): 607Kb downloaded
Running setup.py egg_info for package from
http://pypi.python.org/packages/sou
rce/p/psycopg2/psycopg2-2.4.tar.gz#md5=24f4368e2cfdc1a2b03282ddda814160
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'.
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info\psycopg2.egg-info
writing pip-egg-info\psycopg2.egg-info\PKG-INFO
writing top-level names to pip-egg-info\psycopg2.egg-info\top_level.txt
writing dependency_links to pip-egg-info\psycopg2.egg-info\dependency_links.txt
writing manifest file 'pip-egg-info\psycopg2.egg-info\SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
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'.
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in C:\Documents and Settings\anlopes\Application
Data\pip\p
ip.log
[/quote]
My question:
How can I tell to "pip" where is my pg_config?
Best Regards,
Ensure that pg_config is on your PATH and it should work.
This indicates that you don't have the development packages for
PostgreSQL. psycopg2 is written mostly in C, and needs to be compiled
and linked against PostgreSQL. It does this by running a command
called pg_config, which is part of the PostgreSQL dev package.
You haven't indicated which platform you're on, so I can't tell you
exactly how to install the dev packages. On Ubuntu, it'd be "apt-get
install libpq-dev", for example.
Since this isn't really Django-related, you might want to also take a
look at the psycopg2 docs, especially the parts about building
problems: http://www.initd.org/psycopg/docs/faq.html#problems-compiling-and-deploying-psycopg2.
Good luck,
Jacob
Short version: Type 'which pg_config' at the command line. If it is
found, then it's on your PATH. Otherwise, it's not, which appears to
be the case.
If you want to just do a temporary fix, you can follow these steps:
Run this:
find / -name pg_config 2>>/dev/null
#let's assume the result of the previous command is this:
/usr/lib/postgresql/8.4/bin/pg_config
Add that path to your PATH temporarily
export PATH=$PATH:/usr/lib/postgresql/8.4/bin
You should then be able to do the pip install.
If that doesn't work because pg_config isn't found on your system at
all then see Jacob's suggestions.
Shawn
Yeah, that's the easiest method, but you specifically wanted to know
how to install it with pip. That way you have to install the module
manually. But it works. ;o)
Shawn
Guys, I have a similar problem but the difference is pg_config is actually in my PATH:
$ which pg_config
/usr/pgsql-9.1/bin/pg_config
I get the following error when I try to pip install psychopg2
###################
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'.
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/psycopg2
###################
I tried adding pg_config path to the setup.cfg file and build it using the source files I downloaded from their website and I get the following error message!
Error: Unable to find 'pg_config' file in '/usr/pgsql-9.1/bin/'
But it is actually THERE!!!
I am baffled by these errors. Can anyone help please?
By the way, I sudo all the commands. Also I am RHEL 5.5.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7eb7c3a5-8d1b-4b2e-9ed4-277538b0623a%40googlegroups.com.