Debug IBridgePy on Mac

It is very common to see the following error when IBridgePy runs on Mac.
from IBridgePy import IBCpp
ImportError: dynamic module does not define module export function (PyInit_IBCpp)
The following steps will be helpful to solve the issue.
Step 1. Understand what IBridgePy you have downloaded.
As of 20180906, there are two IBridgePy versions, IBridgePy_Mac_Anaconda27_64 and IBridgePy_Mac_Python27_64
IBridgePy_Mac_Anaconda27_64 means IBridgePy is running on top of Anaconda python 2.7, 64-bit.
IBridgePy_Mac_Python27_64 means IBridgePy is running on native python 2.7, 64-bit, without Anaconda
Step 2. Find what default python you are using, assuming you are not using IDE(Spyder, PyCharm, etc.)
$ which python   —–>find the default python version

If you see “/anaconda2/bin/python”, it means you are using Anaconda Python2.x
$ python    —–> Open python in command line

Python 2.7.14 |Anaconda, Inc.| (default, Dec  7 2017, 11:07:58)

[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin

Type “help”, “copyright”, “credits” or “license” for more information.

>>> —–> It confirms that you are using Anaconda Python 2.7.14

Step 3. Specify a python to run IBridgePy if you really want to
step 3.1 Go to the IBridgePy directory by “$ cd xx/xx/IBridgePy/”
step 3.2 Specify a python to run by ” $ /usr/bin/python”, assuming the native python locates at /usr/bin/python
Or you can specify Anaconda python to run by ” $ /anaconda2/bin/python”
Step 4. Check Python location if you are NOT using Anaconda
Make sure that python framework comes from /System/Library/Frameworks/Python.framework/Versions/2.7/Python

Leave a Reply

Your email address will not be published.