Login  Register

Re: Getting Python bindings in QuantLib-SWIG-1.4 to work in OS X?

Posted by alexs512 on Jun 20, 2016; 4:46pm
URL: http://quantlib.414.s1.nabble.com/Getting-Python-bindings-in-QuantLib-SWIG-1-4-to-work-in-OS-X-tp15105p17551.html

I have just hit the same issue.
I use XCode 6.2. el capitan (10.11).
boost from macports, as well as swig. i know its supposed to work without swig, but it did not.

interestingly enough I could make quantlib/python work couple of weeks ago and the only difference i remember was that i used xcode 7.2. but i have reinstalled my system since, so its impossible to tell.

the quantlib itself builds and seems to be working fine. its just the python interface that gives this 'symbol not found' error, which probably indicates a mismatch between linkers...

here is the full error:

Python 3.5.1 |Anaconda 4.0.0 (x86_64)| (default, Dec  7 2015, 11:24:55)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import QuantLib
Traceback (most recent call last):
  File "/Users/alexeysimonov/dev/QuantLib/QuantLib-SWIG-1.8/Python/build/lib.macosx-10.5-x86_64-3.5/QuantLib/QuantLib.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "/Users/alexeysimonov/anaconda/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 903, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: dlopen(/Users/alexeysimonov/dev/QuantLib/QuantLib-SWIG-1.8/Python/build/lib.macosx-10.5-x86_64-3.5/QuantLib/_QuantLib.cpython-35m-darwin.so, 2): Symbol not found: __ZN8QuantLib10DateParser14parseFormattedERKSsS2_
  Referenced from: /Users/alexeysimonov/dev/QuantLib/QuantLib-SWIG-1.8/Python/build/lib.macosx-10.5-x86_64-3.5/QuantLib/_QuantLib.cpython-35m-darwin.so
  Expected in: flat namespace
 in /Users/alexeysimonov/dev/QuantLib/QuantLib-SWIG-1.8/Python/build/lib.macosx-10.5-x86_64-3.5/QuantLib/_QuantLib.cpython-35m-darwin.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/alexeysimonov/dev/QuantLib/QuantLib-SWIG-1.8/Python/build/lib.macosx-10.5-x86_64-3.5/QuantLib/__init__.py", line 21, in <module>
    from .QuantLib import *
  File "/Users/alexeysimonov/dev/QuantLib/QuantLib-SWIG-1.8/Python/build/lib.macosx-10.5-x86_64-3.5/QuantLib/QuantLib.py", line 21, in <module>
    _QuantLib = swig_import_helper()
  File "/Users/alexeysimonov/dev/QuantLib/QuantLib-SWIG-1.8/Python/build/lib.macosx-10.5-x86_64-3.5/QuantLib/QuantLib.py", line 20, in swig_import_helper
    return importlib.import_module('_QuantLib')
  File "/Users/alexeysimonov/anaconda/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_QuantLib'
>>>



any suggestions what to try?