setting up quantlib, swig-python in ubuntu karmic

April 22, 2010

Hey all,

I am starting this blog to catalog the work I do to get things working and any ideas I have. I finally got rid of windows and installed ubuntu 9.10 (karmic). This post is going to detail how I get everything up and running. (also a reference for me in the future).

First download the most recent version of boost, Quantlib and Quantlib swig.

http://www.boost.org/users/download/

http://sourceforge.net/projects/quantlib/files/ download both the Quantlib and the Quantlib swig versions.

I unzipped the files to /usr/local/lib

doing an ls on my /usr/local/lib directory I have

boost_1_42_0, QuantLib-1.0, QuantLib-SWIG-1.0

next follow the getting started instructions on boost. This will explain how to install the package.

Installing QuantLib-1.0

go into /usr/local/lib/QuantLib-1.0. Quantlib needs to know where the boost directory is when you configure the make file. In /usr/local/lib/QuantLib-1.0

run

  1. sudo ./configure –with-boost-include=/usr/local/lib/boost_1_42_0 –with-boost-lib=/usr/local/lib/boost_1_42_0/libs
  2. sudo make
  3. sudo make install

you need to do sudo because /usr/local/lib is protected.

You now have QuantLib installed.

Next we will install QuantLib-Swig

first make sure QL_LIB is set to your quantlib directory

export QL_LIB=’/usr/local/lib/QuantLib-1.0′

then within the swig directory run

  1. sudo ./configure
  2. sudo make -C Python

for the next step you have to make sure you have python-dev 2.6 package installed. go to System->admistration->synaptic package manager and install python2.6-dev

then go into the /usr/local/lib/QuantLib-SWIG-1.0/Python directory and run

python setup.py build test install

you now have QuantLib-SWIG-1.0 installed!

you can test this by running python.

and then doing from QuantLib import *

so far I’ve found a few useful pdfs

from http://sites.google.com/site/tgwena/

it is also a good idea to install IPython (can do this the same way you install python2.6-dev). IPython is much better than the normal IPython interactive console

Advertisements

Hello world!

April 22, 2010

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!