0

Good evening all, I'm writing my thesis and I'm new with the use of QuantLib. I installed Boost, Quantlib and Swig with HomeBrew on Mac OSX El Capitan but when it try to import QuantLib in my jupyter (IPhyton) notebook in this way: import QuantLib as ql

I always get an error message saying that no quantlib module exists. I have been trying to deal with this problem the whole day but I think I'm missing something :( and I really need quantlib in order to try to develop my case study I would be really glad if someone could help me, thank you.

When I print the path I get this result:

'/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']

S.Stefi
  • 1
  • 3

1 Answers1

1

It sounds like you don't have it correctly installed. Modules are just python code, so if python can't find it then it likely isn't in the source dir. Check by opening a python command and running

import sys
print sys.path

This will give you your system paths that python looks at. You will notice that there are other python modules in these paths. Make sure any new module you install can be seen by these paths.

Steven Walton
  • 375
  • 1
  • 19
  • Thank you so much for your answer, I tried and I think that quantlib is not in the path..how can I fix the problem? Thank you! – S.Stefi May 27 '16 at 07:29
  • You can just move it over to the correct place. Or add the current location to your path. http://stackoverflow.com/questions/3402168/permanently-add-a-directory-to-pythonpath – Steven Walton May 27 '16 at 15:25
  • I still have some problem, I'm trying to fix it. I had some problem with QuantLib SWIG. Now the problem is that I have to add libQuantlib to Python path. I'm looking for a file named libQuantLib.so but the only libQuantLib I have in my Mac is .la format. I know it's a library but I don't know if it will be a problem. I'm gonna try to add it to the path. I really need QuantLib but I'm new in this kind of installations. – S.Stefi Jun 01 '16 at 08:15
  • I also found libQuantLib.dylib in usr/local/lib – S.Stefi Jun 01 '16 at 08:47
  • `.so` is a shared object file where `.la` is a static library. It may be a problem with how you installed. – Steven Walton Jun 01 '16 at 16:13