I used this question/answer to install DB2 in Lion: How do I install IBM DB2 Express-C on Mac OS X 10.7 Lion?
After configuring my databases, I am able to use db2 from the command line to execute queries, but the python modules ibm_db and PyDB2 both fail to import with the following error:
>>> import ibm_db
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/ibm_db-1.0.4-py2.7-macosx-10.7-intel.egg/ibm_db.so, 2): Symbol not found: _dsIsDirServiceRunning
Referenced from: /Users/<username>/sqllib/lib64/libdb2.dylib
Expected in: /System/Library/Frameworks/DirectoryService.framework/Versions/A/DirectoryService
How can I fix this and get ibm_db and PyDB2 to work properly with DB2 in Lion?
edit: moved answer to answers
You can change the db2 libraries using install_name_tool to look at the copied version of DirectoryService.framework, so you don’t have to change DYLD_LIBRARY_PATH
Full credit goes to the following, I am simply updating this thread having been through the process of install db2 / ibm_db on Lion and finding this thread as one of the top hits via Google.
http://www.ibm.com/developerworks/forums/thread.jspa?threadID=238136&start=30&tstart=0
with other options described here:
http://www.ibm.com/developerworks/forums/message.jspa?messageID=14604855#14604855
The answer (should the above thread disappear):
Copy the Snow Leopard DirectoryService.framework to
Then
The referenced post mentions changing a third library
however, I have only installed the db2 client to use the ibm_db python module and this library is not present.