Once upgraded from Lion Mountain to Mavericks (10.9.4), Trac installation stopped working.
First, I try to get it solved by upgrading the Trac installation, but I'm getting the following error message:
$ trac-admin /Users/myuser/Documents/2014/trac upgrade
Error: Cannot load Python bindings for PostgreSQL
Then, by testing directly on the Python console, I can say that this is consistent since I'm getting an equivalent error:
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Python/2.7/site-packages/psycopg2/_psycopg.so, 2)
Library not loaded: libssl.1.0.0.dylib
Referenced from: /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
Reason: image not found
>>>
I have already tried multiple approaches: installing and uninstalling psycopg2
(using pip and easy_install), or even building psycopg2
from sources.
Then, looking around for a solution, I have found some suggestions in these related questions Q1, Q2 and Q3, but without success yet.
otool
, is giving me the following output:
$ otool -L /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
/Library/Python/2.7/site-packages/psycopg2/_psycopg.so:
libpq.5.dylib (compatibility version 5.0.0, current version 5.5.0)
libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
Then, I have tried by setting the DYLD_FALLBACK_LIBRARY_PATH
environment variable like this:
$ echo $DYLD_FALLBACK_LIBRARY_PATH
/Users/myuser/lib:/usr/local/lib:/lib:/usr/lib
Including, restart console and restart the machine, I'm running out of solutions, any idea how I can solve it?
Finally, I have been able to run Trac accessing my old tickets database stored in PostgreSQL 9.2
... After a couple of years of attempts, and a couple of upgrades from Mavericks to Yosemite and then to El Capitan, this has been the solution:
Step 1: Change owner of /usr/local folder
sudo chown -R $(whoami):admin /usr/local
Step 2: Update Path
PG_HOME=/Library/PostgreSQL/9.2
PATH=$PATH:$PG_HOME/bin
Step 3: Reinstall psycopg2
pip uninstall psycopg2
pip install psycopg2
Step 4: Update relative paths used by psycopg2
sudo install_name_tool -change libpq.5.dylib /Library/PostgreSQL/9.2/lib/libpq.5.dylib /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
sudo install_name_tool -change libcrypto.1.0.0.dylib /Library/PostgreSQL/9.2/lib/libcrypto.1.0.0.dylib /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
sudo install_name_tool -change libssl.1.0.0.dylib /Library/PostgreSQL/9.2/lib/libssl.1.0.0.dylib /Library/Python/2.7/site-packages/psycopg2/_psycopg.so