7

How do I install the QuantLib Package in Anaconda. I have tried the following code;

import QuantLib as ql

but I am getting the following result;

ModuleNotFoundError: No module named 'QuantLib'

Can anyone assist me

valiano
  • 16,433
  • 7
  • 64
  • 79
ccc
  • 189
  • 1
  • 3
  • 12
  • How did you install the QuantLib package? Where are their docs? What is the proper way to import from their package? – darthbith Feb 23 '17 at 12:41
  • I tried to install the QuantLib through the Visual Studio but I did not succeed. I have tried almost everything that is on the internet but the installation failed. – ccc Feb 23 '17 at 13:14
  • "almost everything on the internet" Well that's quite a lot! Can you be more specific about what you tried most recently? Its impossible to help with such vague details – darthbith Feb 23 '17 at 13:31
  • I tried what is on this link https://vineetv.wordpress.com/2015/07/07/installing-quantlib-python-windows/ – ccc Feb 23 '17 at 13:48
  • I tried what is on this link https://vineetv.wordpress.com/2015/07/07/installing-quantlib-python-windows/ where I have to install the QuantLib in Visual Studio and download Boost and SWIG and I did not succeed in the last stage of stage in building the project where there was an error (3>LINK : fatal error LNK1104: cannot open file 'ucrtd.lib'). I created an additional path to the ucrtd folder but it still didn't work. I also followed the video on youtube https://www.youtube.com/watch?v=uWMT78XJFJE – ccc Feb 23 '17 at 13:55

3 Answers3

7

You first need to install the QuantLib package. The easiest way I found is to install Anaconda 4.3.1 (link), open a Command Prompt as Admin and run:

pip install QuantLib-Python

For me, this only worked on the latest version of Anaconda including Python 3.6, think the QuantLib-Python package was implemented in PIP only very recently. This might work for other recent installations of Python as well, but it did not work for me on older versions of Anaconda or Python 3.5.

PvK
  • 340
  • 2
  • 15
2

I used this link download quantlib 1.7.1 to install in Windows 10 (I use Anaconda). It was really smooth and no prob at all.

Newbie
  • 451
  • 1
  • 3
  • 14
0

conda install -c conda-forge quantlib does not appear to quite work while it shows a package in conda list as quantlib(note the lower case). The pip installation via python -m pip install QuantLib from Anaconda prompt did the trick for me and import QuantLib as ql runs fine without throwing errors.

see QuantLib-Python installation on Windows for more help.

gregV
  • 987
  • 9
  • 28