I did a simple pip install psycopg2
on mac system. It installed fine, but when I try to use psycopg2 I get the error:
Reason: Incompatible library version: _psycopg.so requires version 1.0.0 or later, but libssl.0.9.8.dylib provides version 0.9.8
pip freeze
shows psycopg2==2.4.5
just right. I have installed psycopg2 on several virtualenvs but this is the first time I am seeing such error. I tried uninstalling and reinstalling, same results. Please help
On OSX 10.11, El Capitan, solution with replacing symlinks reported
Operation not permitted
. Solution that worked for me was using brew and setting up DYLD_LIBRARY_PATH. So:Find where openssl brew libs are located, start searching from directory
/usr/local/Cellar/openssl
. In my case it is in/usr/local/Cellar/openssl/1.0.2d_1/lib
Finally set up DYLD_LIBRARY_PATH, i.e. add a line like this into .bash_profile :
restart shell, or just
source ~/.bash_profile
, reinstall psycopg2:and test if it works:
For me, the libcryto and libss version 1.0.0 resides below:
so the commands that fix my problem is:
When trying to do a syncdb Postgres 9.1 and /psycopg2/_psycopg.so added a further error:
Library not loaded: @loader_path/../lib/libcrypto.dylib Referenced from: /usr/lib/libpq.5.dylib Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later, but libcrypto.0.9.8.dylib provides version 0.9.8
Solved by copying these six (6) files from:
LOCAL:/Library/PostgreSQL/9.1/lib/
libssl.1.0.0.dylib
libssl.a
libssl.dylib
libcrypto.1.0.0.dylib
libcrypto.a
libcrypto.dylib
to: LOCAL:/usr/lib
This was on Mac OSx 10.8.1 with a web in a virtualenv (1.8.2) and pgAdmin (1.14.3). Inside the virtualenv is:
Django==1.4
psycopg2==2.4.5
... etc... and now back to normal.
I ran into a similar problem after upgrading to Mountain Lion.
Instead of copying libssl.* files per Slack's suggestion, make sure that
/usr/lib/libssl.dylib
is actually a soft link to the most up-to-date version of the library.E.g., on my machine,
ls -l /usr/lib/libssl*
gives:If
libssl.dylib
doesn't link to the version that the error version mentions, make sure you have that version of the library, and then make sure/usr/lib/libssl.dylib
points to it, and not an older version.If the link doesn't exist, create it like so
using, of course, the proper locations for your machine. For me, this turned out to be:
Edit:
It seems like some are having trouble with part of my solution. Namely, deleting these important libraries even temporarily causes problems with the operating system.
Per Purrell's answer, make sure you include the
-fs
flags when you use theln
command, which helps ensure that the libraries don't go missing for a short period of time. E.g.,The accepted answer here is correct (except I think it must be ln -fs , in fact I think it might even risk destabalizing your OS if not (?)). After bumping into this and dealing with it I just want to collect the full solution for this issue and the other lib problem (libcrypto.1.0.0.dylib) you will run into for Postgres 9.* on Mountain Lion and Snow Leopard, and perhaps other systems. This also blocked me from running psql, which complained about the same two libs.
Essentially there are two later-version libs needed in
/usr/lib
, libssl and libcrypto. You can find the needed versions of these libs in the Postgres lib directory./Library/PostgreSQL/9.2/lib
./Applications/Postgres.app/Contents/MacOS/lib
,/usr/local/Cellar
,First copy the latest of these two libs from the Postgres lib directory to
/usr/lib
:Then update (or create) the /usr/lib symlinks for this libs. Either way the command is
ln -fs
:Should be fixed. Pretty sure ln -fs is better than deleting the symlink and remaking it, so there is less chance of libssl being unfindable by something that needs it for the time it is not present (it does the same thing; it first deletes the symlink if it's already there, just faster than you can type it). Always wary of messing around on /usr/lib.
my friend, just copy libssl.* files from PostgreSQL lib directory to /usr/lib and relaunch your application in this case all things will be perfect ^_^