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

Saba Kauser report at bugs.python.org
Tue Apr 16 06:01:59 EDT 2019


Saba Kauser <skauseribmdb at gmail.com> added the comment:

Thanks Karthikeyan.

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
>>

The error Reason: image not found is specific to MAC due to its security setting and I have added a workaround that is expected to work with pip install. However, it does not seem to work.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36640>
_______________________________________


More information about the Python-bugs-list mailing list