python ibm_db setup.py post install script does not seem to work from Anaconda

49 views
Skip to first unread message

skause...@gmail.com

unread,
Apr 19, 2019, 11:34:08 PM4/19/19
to Anaconda - Public
i,
I have added a post install class that's working fine when I do "pip install ibm_db" on MAC from a standalone python installation. However, when I use the python/pip from anaconda3(python 3.7), the same pip is not executing the post install script.
Can some one please take a look and assist.
The class can be seen at:
https://github.com/ibmdb/python-ibmdb/blob/master/IBM_DB/ibm_db/setup.py#L52

Post install, I am expecting following output:
BLR-D-MACOS03:site-packages skauser$ otool -L ibm_db.cpython-37m-darwin.so ibm_db.cpython-37m-darwin.so:
        @loader_path/clidriver/lib/libdb2.dylib (compatibility version 0.0.0, current version 0.0.0)

When executing from Anaconda, the name of libdb2.dylib is unchanged.

The behavior is specific to anaconda when I use the python/pip that comes with it. When I use the pip from anaconda, e.g:/Users/skauser/anaconda3/bin/pip pip install ibm_db Installation is success,but when I import ibm_db, I get this error import ibm_db >>> import ibm_db Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: dlopen(/Users/skauser/anaconda3/lib/python3.7/site-packages/ibm_db.cpython-37m-darwin.so, 2): Library not loaded: libdb2.dylib Referenced from: /Users/skauser/anaconda3/lib/python3.7/site-packages/ibm_db.cpython-37m-darwin.so Reason: image not found Reason being, the post install script of my setup.py is not executed and hence following command did not run post install . for so in glob.glob(get_python_lib()+r'/ibm_db*.so'): os.system("install_name_tool -change libdb2.dylib {}/lib/libdb2.dylib {}".format(clipath, so)) Can be seen at https://github.com/ibmdb/python-ibmdb/blob/master/IBM_DB/ibm_db/setup.py#L58 However, when I use the standalone python installation that is outside of anaconda distribution, pip install correctly runs the post install script ibm_db's setup.py. /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 03:13:28) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import ibm_db >>

Another thing to note is that, when I build the source using "python setup.py build" & install via "python setup.py install", the install_name_tool is correctly
able to rename the library name.

This is blocking the seamless adoption of python ibm_db as many users in developer community are using anaconda.
Kindly help!

Sanket B.

unread,
Jun 3, 2021, 12:53:32 AMJun 3
to Anaconda - Public, skause...@gmail.com
hey i have similar error. if your error is resolved then please help me to solve my error.
Reply all
Reply to author
Forward
0 new messages