2

I'm getting the below error when trying to run postgres with psycopg2 app:

Error loading psycopg2 module: dlopen(/Users/Yunti/.virtualenvs/switcher2/lib/python3.4/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: /Applications/Postgres.app/Contents/Versions/9.4/lib/libssl.1.0.0.dylib
Referenced from: /Users/Yunti/.virtualenvs/switcher2/lib/python3.4/site-packages/psycopg2/_psycopg.so
Reason: image not found

Which I originally thought was caused by the brew installation of postgres. However it seems like psycog2 is pointing to the previously installed version of the postgres app.

The postgres app was previously uninstalled before installing postgres via brew and the virtualenv used set up afterwards. I presume I must have not removed something relating to the postgres app in the uninstall process but have no idea how psycopg2 has ended up pointing to it.
(Note if I uninstall postgres in brew and reinstall the postgres app it all starts working again)

Note a uninstall & reinstall of psycopg2 didn't fix. Neither did removing the brew installed version of postgresql and reinstalling it and then reinstalling psycopg2 again after that.

Yunti
  • 6,761
  • 12
  • 61
  • 106
  • Have you checked [this answer][1]? [1]: http://stackoverflow.com/questions/16407995/psycopg2-image-not-found – jlnabais Sep 10 '15 at 21:19
  • Yes I had seen it, it seems to be a collection of different answer for different but related problems - none of which solved it unfortunately. – Yunti Sep 11 '15 at 13:16

1 Answers1

4

An uninstall and reinstall of psycopg2 was nearly the solution. However pip was reinstalling the cached version of psycopg2. This still referenced the previously installed postgres app which had since been removed and reinstalled via brew.

The solution is to:

pip uninstall psycopg2

and then reinstall without using the cache:

pip install psycopg2 --no-cache-dir
Yunti
  • 6,761
  • 12
  • 61
  • 106