Installing QuantLib and QuantLib-Python in Windows

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Installing QuantLib and QuantLib-Python in Windows

nbalta02

Hi All,

 

I have installed QuantLib and QuantLib-Python in Windows (I used Anaconda win32) and went through all the steps successfully, including the tests.

 

C:\local\QuantLib-SWIG-1.6\Python>python setup.py test

running test

running build

running build_py

running build_ext

testing QuantLib 1.6

runTest (date.DateTest)

Testing date arithmetics ... ok

testObservable (instruments.InstrumentTest)

Testing observability of stocks ... ok

…………………………………………………..

Testing asset-swap prices and spreads for specialized bond against equivalent generic bond... ... ok

testZSpread (assetswap.AssetSwapTest)

Testing clean and dirty price with null Z-spread against theoretical prices... ... ok

testZSpreadWithGenericBond (assetswap.AssetSwapTest)

Testing clean and dirty price with null Z-spread against theoretical prices... ... ok

 

----------------------------------------------------------------------

Ran 36 tests in 0.643s

 

OK

 

However, when I try to import QuantLib, I get the following error message:

 

C:\local\QuantLib-SWIG-1.6\Python>python

Python 2.7.11 |Anaconda 2.4.1 (32-bit)| (default, Dec  7 2015, 14:13:17) [MSC v.1500 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

Anaconda is brought to you by Continuum Analytics.

Please check out: http://continuum.io/thanks and https://anaconda.org

 

>>> from QuantLib import *

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "QuantLib\__init__.py", line 24, in <module>

    from QuantLib import *

  File "QuantLib\QuantLib.py", line 28, in <module>

    _QuantLib = swig_import_helper()

  File "QuantLib\QuantLib.py", line 20, in swig_import_helper

    import _QuantLib

ImportError: No module named _QuantLib

 

My environment variables seem reasonable, and were used successfully to build, test and install QuantLib.  Here they are (only a relevant portion):

 

INCLUDE=C:\local\boost_1_58_0;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program F

iles (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;C:\local\boost_1_57_0

LIB=C:\local\boost_1_58_0\lib32-msvc-12.0;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86;

 

LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB;C:\Program Files (x86)\Windows Kits\8.1\Referen

ces\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\Microsoft.VCLibs\12.0\References\CommonConfiguration\neutral;

LOCALAPPDATA=C:\Users\nikos\AppData\Local

LOGONSERVER=\\MicrosoftAccount

myboost=C:\local\boost_1_58_0

NUMBER_OF_PROCESSORS=8

OnlineServices=Online Services

OPENSSL_CONF=C:\Program Files\PostgreSQL\psqlODBC\0903\etc\openssl.cnf

OS=Windows_NT

Path=C:\Users\nikos\Anaconda2;C:\Users\nikos\Anaconda2\Scripts;C:\local\swigwin-3.0.6;C:\local\QuantLib-1.6\lib;C:\Program Files (x86)\Microsoft Visual Studio 1

2.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\MSBuild\12.0\bin;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\;C

:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v

4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools;C:\

Program Files (x86)\Windows Kits\8.1\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Prog

ram Files (x86)\HP SimplePass\x64;C:\Program Files (x86)\HP SimplePass\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program

Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program File

s (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel

(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Co

mponents\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\Wireles

sCommon\;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Progr

am Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Anaconda3;C:\Anaconda3\Scripts;C

:\Anaconda3\Library\bin;C:\Users\nikos\Anaconda2;C:\Users\nikos\Anaconda2\Scripts;C:\Users\nikos\Anaconda2\Library\bin;C:\local\swigwin-3.0.6

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Python=C:\Anaconda

PYTHONPATH=C:\local\QuantLib-SWIG-1.6\Python\QuantLib;C:\local\QuantLib-SWIG-1.6\Python

 

Can you please shed some light, on why I cannot import QuantLib on the python program.

I have also tried through the Spyder IDE with no success.

 

I will be grateful for a quick reply.

 

Many thanks and Happy New Year to all of you.

 

Nikos


------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Installing QuantLib and QuantLib-Python in Windows

Luigi Ballabio
Hello,
    did you run `python setup.py install`? That should copy all the necessary files where Python can find them.  If you didn't, you also have to add to PYTHONPATH the directories where the module is built (python setup.py test does this before importing QuantLib and running the tests). To find them, you can execute:

from distutils.command.build import build
print build.build_purelib
print build.build_platlib

As I said, though, running `python setup.py install` should make this unnecessary.

Luigi



On Wed, Dec 30, 2015 at 4:02 AM Nikos Baltas <[hidden email]> wrote:

Hi All,

 

I have installed QuantLib and QuantLib-Python in Windows (I used Anaconda win32) and went through all the steps successfully, including the tests.

 

C:\local\QuantLib-SWIG-1.6\Python>python setup.py test

running test

running build

running build_py

running build_ext

testing QuantLib 1.6

runTest (date.DateTest)

Testing date arithmetics ... ok

testObservable (instruments.InstrumentTest)

Testing observability of stocks ... ok

…………………………………………………..

Testing asset-swap prices and spreads for specialized bond against equivalent generic bond... ... ok

testZSpread (assetswap.AssetSwapTest)

Testing clean and dirty price with null Z-spread against theoretical prices... ... ok

testZSpreadWithGenericBond (assetswap.AssetSwapTest)

Testing clean and dirty price with null Z-spread against theoretical prices... ... ok

 

----------------------------------------------------------------------

Ran 36 tests in 0.643s

 

OK

 

However, when I try to import QuantLib, I get the following error message:

 

C:\local\QuantLib-SWIG-1.6\Python>python

Python 2.7.11 |Anaconda 2.4.1 (32-bit)| (default, Dec  7 2015, 14:13:17) [MSC v.1500 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

Anaconda is brought to you by Continuum Analytics.

Please check out: http://continuum.io/thanks and https://anaconda.org

 

>>> from QuantLib import *

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "QuantLib\__init__.py", line 24, in <module>

    from QuantLib import *

  File "QuantLib\QuantLib.py", line 28, in <module>

    _QuantLib = swig_import_helper()

  File "QuantLib\QuantLib.py", line 20, in swig_import_helper

    import _QuantLib

ImportError: No module named _QuantLib

 

My environment variables seem reasonable, and were used successfully to build, test and install QuantLib.  Here they are (only a relevant portion):

 

INCLUDE=C:\local\boost_1_58_0;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program F

iles (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;C:\local\boost_1_57_0

LIB=C:\local\boost_1_58_0\lib32-msvc-12.0;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86;

 

LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB;C:\Program Files (x86)\Windows Kits\8.1\Referen

ces\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\Microsoft.VCLibs\12.0\References\CommonConfiguration\neutral;

LOCALAPPDATA=C:\Users\nikos\AppData\Local

LOGONSERVER=\\MicrosoftAccount

myboost=C:\local\boost_1_58_0

NUMBER_OF_PROCESSORS=8

OnlineServices=Online Services

OPENSSL_CONF=C:\Program Files\PostgreSQL\psqlODBC\0903\etc\openssl.cnf

OS=Windows_NT

Path=C:\Users\nikos\Anaconda2;C:\Users\nikos\Anaconda2\Scripts;C:\local\swigwin-3.0.6;C:\local\QuantLib-1.6\lib;C:\Program Files (x86)\Microsoft Visual Studio 1

2.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\MSBuild\12.0\bin;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\;C

:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v

4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools;C:\

Program Files (x86)\Windows Kits\8.1\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Prog

ram Files (x86)\HP SimplePass\x64;C:\Program Files (x86)\HP SimplePass\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program

Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program File

s (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel

(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Co

mponents\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\Wireles

sCommon\;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Progr

am Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Anaconda3;C:\Anaconda3\Scripts;C

:\Anaconda3\Library\bin;C:\Users\nikos\Anaconda2;C:\Users\nikos\Anaconda2\Scripts;C:\Users\nikos\Anaconda2\Library\bin;C:\local\swigwin-3.0.6

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Python=C:\Anaconda

PYTHONPATH=C:\local\QuantLib-SWIG-1.6\Python\QuantLib;C:\local\QuantLib-SWIG-1.6\Python

 

Can you please shed some light, on why I cannot import QuantLib on the python program.

I have also tried through the Spyder IDE with no success.

 

I will be grateful for a quick reply.

 

Many thanks and Happy New Year to all of you.

 

Nikos

------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
--

------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Installing QuantLib and QuantLib-Python in Windows

Dr. Harald Hubbes

Dear Luigi,

 

Thank you for your kind advise, Phyton was properly installed apparently, analog to your suggestion,  and meanwhile the full quantLibXll version is compiled successfully in 32bit and 64 bit.

 

Kind regards, Harald

 

 

From: Luigi Ballabio [mailto:[hidden email]]
Sent: Dienstag, 5. Januar 2016 16:16
To: Nikos Baltas; [hidden email]
Subject: Re: [Quantlib-users] Installing QuantLib and QuantLib-Python in Windows

 

Hello,

    did you run `python setup.py install`? That should copy all the necessary files where Python can find them.  If you didn't, you also have to add to PYTHONPATH the directories where the module is built (python setup.py test does this before importing QuantLib and running the tests). To find them, you can execute:

 

from distutils.command.build import build

print build.build_purelib

print build.build_platlib

 

As I said, though, running `python setup.py install` should make this unnecessary.

 

Luigi

 

 

 

On Wed, Dec 30, 2015 at 4:02 AM Nikos Baltas <[hidden email]> wrote:

Hi All,

 

I have installed QuantLib and QuantLib-Python in Windows (I used Anaconda win32) and went through all the steps successfully, including the tests.

 

C:\local\QuantLib-SWIG-1.6\Python>python setup.py test

running test

running build

running build_py

running build_ext

testing QuantLib 1.6

runTest (date.DateTest)

Testing date arithmetics ... ok

testObservable (instruments.InstrumentTest)

Testing observability of stocks ... ok

…………………………………………………..

Testing asset-swap prices and spreads for specialized bond against equivalent generic bond... ... ok

testZSpread (assetswap.AssetSwapTest)

Testing clean and dirty price with null Z-spread against theoretical prices... ... ok

testZSpreadWithGenericBond (assetswap.AssetSwapTest)

Testing clean and dirty price with null Z-spread against theoretical prices... ... ok

 

----------------------------------------------------------------------

Ran 36 tests in 0.643s

 

OK

 

However, when I try to import QuantLib, I get the following error message:

 

C:\local\QuantLib-SWIG-1.6\Python>python

Python 2.7.11 |Anaconda 2.4.1 (32-bit)| (default, Dec  7 2015, 14:13:17) [MSC v.1500 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

Anaconda is brought to you by Continuum Analytics.

Please check out: http://continuum.io/thanks and https://anaconda.org

 

>>> from QuantLib import *

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "QuantLib\__init__.py", line 24, in <module>

    from QuantLib import *

  File "QuantLib\QuantLib.py", line 28, in <module>

    _QuantLib = swig_import_helper()

  File "QuantLib\QuantLib.py", line 20, in swig_import_helper

    import _QuantLib

ImportError: No module named _QuantLib

 

My environment variables seem reasonable, and were used successfully to build, test and install QuantLib.  Here they are (only a relevant portion):

 

INCLUDE=C:\local\boost_1_58_0;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program F

iles (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;C:\local\boost_1_57_0

LIB=C:\local\boost_1_58_0\lib32-msvc-12.0;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86;

 

LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB;C:\Program Files (x86)\Windows Kits\8.1\Referen

ces\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\Microsoft.VCLibs\12.0\References\CommonConfiguration\neutral;

LOCALAPPDATA=C:\Users\nikos\AppData\Local

LOGONSERVER=\\MicrosoftAccount

myboost=C:\local\boost_1_58_0

NUMBER_OF_PROCESSORS=8

OnlineServices=Online Services

OPENSSL_CONF=C:\Program Files\PostgreSQL\psqlODBC\0903\etc\openssl.cnf

OS=Windows_NT

Path=C:\Users\nikos\Anaconda2;C:\Users\nikos\Anaconda2\Scripts;C:\local\swigwin-3.0.6;C:\local\QuantLib-1.6\lib;C:\Program Files (x86)\Microsoft Visual Studio 1

2.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\MSBuild\12.0\bin;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\;C

:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v

4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools;C:\

Program Files (x86)\Windows Kits\8.1\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Prog

ram Files (x86)\HP SimplePass\x64;C:\Program Files (x86)\HP SimplePass\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program

Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program File

s (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel

(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Co

mponents\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\Wireles

sCommon\;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Progr

am Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Anaconda3;C:\Anaconda3\Scripts;C

:\Anaconda3\Library\bin;C:\Users\nikos\Anaconda2;C:\Users\nikos\Anaconda2\Scripts;C:\Users\nikos\Anaconda2\Library\bin;C:\local\swigwin-3.0.6

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Python=C:\Anaconda

PYTHONPATH=C:\local\QuantLib-SWIG-1.6\Python\QuantLib;C:\local\QuantLib-SWIG-1.6\Python

 

Can you please shed some light, on why I cannot import QuantLib on the python program.

I have also tried through the Spyder IDE with no success.

 

I will be grateful for a quick reply.

 

Many thanks and Happy New Year to all of you.

 

Nikos

------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

--


------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Installing QuantLib and QuantLib-Python in Windows

nbalta02
In reply to this post by Luigi Ballabio

Hi Luigi,

 

Thank you for coming back.

I had already resolved the problem.

I had run ‘python setup.py install’ but still would not find the QuantLib module, although all the files had been installed on the ..\Anaconda2\Lib\site-packages\QuantLib.

I then realised that I had to set the PYTHONPATH to point to that directory, which I set it and then everything worked.

 

Thanks again.

Nikos

 

From: Luigi Ballabio [mailto:[hidden email]]
Sent: 05 January 2016 15:16
To: Nikos Baltas <[hidden email]>; [hidden email]
Subject: Re: [Quantlib-users] Installing QuantLib and QuantLib-Python in Windows

 

Hello,

    did you run `python setup.py install`? That should copy all the necessary files where Python can find them.  If you didn't, you also have to add to PYTHONPATH the directories where the module is built (python setup.py test does this before importing QuantLib and running the tests). To find them, you can execute:

 

from distutils.command.build import build

print build.build_purelib

print build.build_platlib

 

As I said, though, running `python setup.py install` should make this unnecessary.

 

Luigi

 

 

 

On Wed, Dec 30, 2015 at 4:02 AM Nikos Baltas <[hidden email]> wrote:

Hi All,

 

I have installed QuantLib and QuantLib-Python in Windows (I used Anaconda win32) and went through all the steps successfully, including the tests.

 

C:\local\QuantLib-SWIG-1.6\Python>python setup.py test

running test

running build

running build_py

running build_ext

testing QuantLib 1.6

runTest (date.DateTest)

Testing date arithmetics ... ok

testObservable (instruments.InstrumentTest)

Testing observability of stocks ... ok

…………………………………………………..

Testing asset-swap prices and spreads for specialized bond against equivalent generic bond... ... ok

testZSpread (assetswap.AssetSwapTest)

Testing clean and dirty price with null Z-spread against theoretical prices... ... ok

testZSpreadWithGenericBond (assetswap.AssetSwapTest)

Testing clean and dirty price with null Z-spread against theoretical prices... ... ok

 

----------------------------------------------------------------------

Ran 36 tests in 0.643s

 

OK

 

However, when I try to import QuantLib, I get the following error message:

 

C:\local\QuantLib-SWIG-1.6\Python>python

Python 2.7.11 |Anaconda 2.4.1 (32-bit)| (default, Dec  7 2015, 14:13:17) [MSC v.1500 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

Anaconda is brought to you by Continuum Analytics.

Please check out: http://continuum.io/thanks and https://anaconda.org

 

>>> from QuantLib import *

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "QuantLib\__init__.py", line 24, in <module>

    from QuantLib import *

  File "QuantLib\QuantLib.py", line 28, in <module>

    _QuantLib = swig_import_helper()

  File "QuantLib\QuantLib.py", line 20, in swig_import_helper

    import _QuantLib

ImportError: No module named _QuantLib

 

My environment variables seem reasonable, and were used successfully to build, test and install QuantLib.  Here they are (only a relevant portion):

 

INCLUDE=C:\local\boost_1_58_0;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.1\include\shared;C:\Program F

iles (x86)\Windows Kits\8.1\include\um;C:\Program Files (x86)\Windows Kits\8.1\include\winrt;C:\local\boost_1_57_0

LIB=C:\local\boost_1_58_0\lib32-msvc-12.0;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB;C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86;

 

LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB;C:\Program Files (x86)\Windows Kits\8.1\Referen

ces\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\Microsoft.VCLibs\12.0\References\CommonConfiguration\neutral;

LOCALAPPDATA=C:\Users\nikos\AppData\Local

LOGONSERVER=\\MicrosoftAccount

myboost=C:\local\boost_1_58_0

NUMBER_OF_PROCESSORS=8

OnlineServices=Online Services

OPENSSL_CONF=C:\Program Files\PostgreSQL\psqlODBC\0903\etc\openssl.cnf

OS=Windows_NT

Path=C:\Users\nikos\Anaconda2;C:\Users\nikos\Anaconda2\Scripts;C:\local\swigwin-3.0.6;C:\local\QuantLib-1.6\lib;C:\Program Files (x86)\Microsoft Visual Studio 1

2.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\MSBuild\12.0\bin;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\;C

:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v

4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools;C:\

Program Files (x86)\Windows Kits\8.1\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Prog

ram Files (x86)\HP SimplePass\x64;C:\Program Files (x86)\HP SimplePass\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program

Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program File

s (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel

(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Co

mponents\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\Wireles

sCommon\;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Progr

am Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Anaconda3;C:\Anaconda3\Scripts;C

:\Anaconda3\Library\bin;C:\Users\nikos\Anaconda2;C:\Users\nikos\Anaconda2\Scripts;C:\Users\nikos\Anaconda2\Library\bin;C:\local\swigwin-3.0.6

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

Python=C:\Anaconda

PYTHONPATH=C:\local\QuantLib-SWIG-1.6\Python\QuantLib;C:\local\QuantLib-SWIG-1.6\Python

 

Can you please shed some light, on why I cannot import QuantLib on the python program.

I have also tried through the Spyder IDE with no success.

 

I will be grateful for a quick reply.

 

Many thanks and Happy New Year to all of you.

 

Nikos

------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

--


------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users