problem with Python Bindings for QuantLib

Posted by Laughing Man-2 on
URL: http://quantlib.414.s1.nabble.com/problem-with-Python-Bindings-for-QuantLib-tp355.html

Hi, 

I hope someone can help me with this: I've got a problem building the Python Bindings for QuantLib, I get stack in the build process...
I have tried to follow the instructions I had found on another site: http://www.wilmott.com/messageview.cfm?catid=10&threadid=34537

With VC 7.1, you can just enter the QuantLib-SWIG\Python directory, open a command shell, and type:

set QL_DIR=V:\somewhere\QuantLib (replace with the directory where you saved and compiled QuantLib)
python setup.py build test

If everything works, run

python setup.py install

and you're ready.

However I'm running into trouble, most likely due to some compiler versions incompatibility.
If I just type:

python setup.py build 

then I have the following error messages (truncated):

C:\build_ql_1_0_1\QuantLib-SWIG-1.0\Python>python setup.py build
running build
running build_py
running build_ext
building 'QuantLib._QuantLib' extension
C:\Program Files\pythonxy\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python25\include -IC:\Python25\PC -c QuantLib/quantlib_wrap.cpp -o build\temp.win32-2.5\Release\qu
\quantlib_wrap.o
QuantLib/quantlib_wrap.cpp:3370:26: ql/version.hpp: No such file or directory
QuantLib/quantlib_wrap.cpp:3371: error: `QL_HEX_VERSION' was not declared in this scope
QuantLib/quantlib_wrap.cpp:3372: error: `QL_VERSION' was not declared in this scope
QuantLib/quantlib_wrap.cpp:3431:27: ql/quantlib.hpp: No such file or directory
QuantLib/quantlib_wrap.cpp:3434:6: #error using an old version of QuantLib, please update
QuantLib/quantlib_wrap.cpp:3821:48: boost/algorithm/string/case_conv.hpp: No such file or directory
QuantLib/quantlib_wrap.cpp:3825: error: `QuantLib' has not been declared
QuantLib/quantlib_wrap.cpp:3825: error: expected nested-name-specifier before "Error"
QuantLib/quantlib_wrap.cpp:3825: error: `Error' has not been declared
QuantLib/quantlib_wrap.cpp:3826: error: `QuantLib' has not been declared


After having guessed that probably distutils was not happy because it was not using the same compiler with which I built QuantLib (VC 9.0) I tried to type this:

python setup.py build  --compiler=msvc

but had no better luck:

C:\build_ql_1_0_1\QuantLib-SWIG-1.0\Python>python setup.py build --compiler=msvc
running build
running build_py
running build_ext
warning: unable to detect QuantLib installation
error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.

Stepping through the python code for distutils, I realized that there is some kind of incompatibility with the Microsoft SDK versions. Indeed distutils (I use Python 2.5 from a PythonXY distribution) expects to work with SDK 1.1, but my SDK is 2.0. I actually also happen to have Visual Studio 8 on my computer -along with Visual Studio 9 and also 6- and for some reason distutils seems to pick VStudio 8 as default Microsoft compiler.

Could anyone please help me fixing this issue or suggest an alternative way to use Python with QuantLib? Isn't there any pre-compiled Python Bindings available?

Many thanks in advance.

LM











------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users