python pip install psycopg2 install error

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.

  • If you’re OSX and installed the Enterprise DB version of Postgres this will be in /Library/PostgreSQL/9.2/lib.
  • For other install types of Postgres, look for the lib directory inside the Postgress install directory, e.g., for Postgress.app, find the lib directory in /Applications/Postgres.app/Contents/MacOS/lib,
  • for brew somewhere in /usr/local/Cellar,
  • on *nix, wherever your install is. But see first on *nix if your distro has later versions just through the package manager.

First copy the latest of these two libs from the Postgres lib directory to /usr/lib:

sudo cp /Library/PostgreSQL/9.2/lib/libssl.1.0.0.dylib /usr/lib
sudo cp /Library/PostgreSQL/9.2/lib/libcrypto.1.0.0.dylib /usr/lib

Then update (or create) the /usr/lib symlinks for this libs. Either way the command is ln -fs:

sudo ln -fs /usr/lib/libssl.1.0.0.dylib /usr/lib/libssl.dylib
sudo ln -fs /usr/lib/libcrypto.1.0.0.dylib /usr/lib/libcrypto.dylib

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.

Leave a Comment