1

This is what I am getting:

Adnans-MBP:~ AdnanAhmad$ easy_install psycopg2
Searching for psycopg2
Reading https://pypi.python.org/simple/psycopg2/
Downloading https://pypi.python.org/packages/7b/a8/dc2d50a6f37c157459cd18bab381c8e6134b9381b50fbe969997b2ae7dbc/psycopg2-2.6.2.tar.gz#md5=4a392949ba31a378a18ed3e775a4693f
Best match: psycopg2 2.6.2
Processing psycopg2-2.6.2.tar.gz
Writing /var/folders/d3/t5c58nx570ggzzknhm4zpjnw0000gn/T/easy_install-66rCLK/psycopg2-2.6.2/setup.cfg
Running psycopg2-2.6.2/setup.py -q bdist_egg --dist-dir /var/folders/d3/t5c58nx570ggzzknhm4zpjnw0000gn/T/easy_install-66rCLK/psycopg2-2.6.2/egg-dist-tmp-Vu8qsu
In file included from psycopg/psycopgmodule.c:27:
./psycopg/psycopg.h:31:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
         ^
1 error generated.
error: Setup script exited with error: command 'gcc' failed with exit status 1

I am using PostgreSql.app

Volatil3
  • 14,253
  • 38
  • 134
  • 263

1 Answers1

1

well, since you are using anaconda anyways, might as well take advantage of their binary packages! They have one for PostgreSQL! just type

conda install psycopg2
avloss
  • 2,389
  • 2
  • 22
  • 26
  • Seems it does install but now I get error: `Referenced from: //anaconda/lib/python2.7/site-packages/psycopg2/_psycopg.so Reason: image not found` – Volatil3 Feb 24 '17 at 10:35
  • I would try `pip uninstall psycopg2 && conda uninstall psycopg2` and try to re-install the whole thing! if your error actually starts with `//anaconda/..` that looks strange to me. – avloss Feb 24 '17 at 10:37
  • this looks similar http://stackoverflow.com/questions/16407995/psycopg2-image-not-found – avloss Feb 24 '17 at 10:37
  • Saw this but sadly I don't have such path available at all – Volatil3 Feb 24 '17 at 10:40
  • check if you got that file at all.. `find / -name _psycopg.so`. then if you do, put a soft link in the place where it tries to find it – avloss Feb 24 '17 at 10:41
  • `/anaconda/lib/python2.7/site-packages/psycopg2/_psycopg.so /anaconda/pkgs/psycopg2-2.6.2-py27_0/lib/python2.7/site-packages/psycopg2/_psycopg.so` – Volatil3 Feb 24 '17 at 10:51
  • well try this at your own risk: `rm -rf /anaconda/lib/python2.7/site-packages/psycopg2/_psycopg.so && ln -s /anaconda/pkgs/psycopg2-2.6.2-py27_0/lib/python2.7/site-pack‌​ages/psycopg2/_psyco‌​pg.so /anaconda/lib/python2.7/site-packages/psycopg2/_psycopg.so ` – avloss Feb 24 '17 at 11:43
  • I had to link up PostgreSQL Librares in /usr/local and it worked – Volatil3 Feb 24 '17 at 13:34