Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems using psycopg2 on Mac OS (Yosemite)

Currently I am installing psycopg2 for work within eclipse with python.

I am finding a lot of problems:

  1. The first problem sudo pip3.4 install psycopg2 is not working and it is showing the following message

Error: pg_config executable not found.

FIXED WITH:export PATH=/Library/PostgreSQL/9.4/bin/:"$PATH”

  1. When I import psycopg2 in my project i obtein:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so Library libssl.1.0.0.dylib Library libcrypto.1.0.0.dylib

FIXED WITH: sudo ln -s /Library/PostgreSQL/9.4/lib/libssl.1.0.0.dylib /usr/lib sudo ln -s /Library/PostgreSQL/9.4/lib/libcrypto.1.0.0.dylib /usr/lib

  1. Now I am obtaining:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _lo_lseek64 Referenced from: /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so Expected in: /usr/lib/libpq.5.dylib in /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/psycopg2/_psycopg.so

Can you help me?

like image 591
Benja Garrido Avatar asked Feb 14 '15 13:02

Benja Garrido


2 Answers

You need to replace the /usr/lib/libpq.5.dylib library because its version is too old.
Here's my solution to this problem:

$ sudo mv /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib.old   $ sudo ln -s /Library/PostgreSQL/9.4/lib/libpq.5.dylib /usr/lib 
like image 191
KungFuLucky7 Avatar answered Oct 03 '22 22:10

KungFuLucky7


If you are using PostgresApp, you need to run the following two commands:

sudo mv /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib.old sudo ln -s /Applications/Postgres.app/Contents/Versions/9.4/lib/libpq.5.dylib /usr/lib 
like image 43
Samer Avatar answered Oct 03 '22 23:10

Samer