Needing Help installing QuantLib for Python on Windows machine

Discussion in 'App Development' started by Stamamarti, Jun 10, 2020.

  1. I am a R user, but trying to venture into Python primarily for using canned scripts for calibrating the Heston Model which uses Quantlib. I am encountering some obstacles in installing (and running) the QuantLib package for Python on my window based machine. Any pointers/suggestions on the shortest and simplest way to install it would be greatly appreciated.

    Many thanks
    SA

    (ps: I do not have a C wrapper or the likes. )
     
  2. d08

    d08

    haven't used it but what happened when you did "pip install quantlib"?
     
  3. Not much as pip is not a windows command. Note that I would not have posted here prior to a thorough google search of all the listed options out there... I did...
     
  4. d08

    d08

    Pip is bundled with Python installation nowadays and can be installed separately. Not sure what you mean by "windows command". I'm currently on Windows and can install it without problems.
     
  5. Thx-- Here is what I get-- I must be doing something wrong---

    Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pip
    >>> help(pip)
    Help on package pip:

    NAME
    pip

    PACKAGE CONTENTS
    __main__
    _internal (package)
    _vendor (package)

    VERSION
    19.2.3

    FILE
    c:\users\XXX\appdata\local\programs\python\python38-32\lib\site-packages\pip\__init__.py


    >>> pip install quantlib
    File "<stdin>", line 1
    pip install quantlib
    ^
    SyntaxError: invalid syntax
    >>>
     
  6. zenlot

    zenlot

    If you don't have yet, install Windows Terminal (much nicer to work with: https://github.com/Microsoft/Terminal ). If not PowerShell will work too. Then open it and do:

    C:\Users\your_user> python.exe -m pip install --user quantlib (you can remove --user to install globally)

    If you have pip in path, you can start with 'pip' directly. But using python in fron helps you to identify the correct version you're installing to (if you have more than one installations).

    Also, few other options:
    a) you can use WSL (windows subsystem for Linux) and work like in a standard Linux environment.
    b) get Docker desktop installed and run python within container, e.g: docker run --rm -it python:3.8.3 bash
    And play around with python within container.
     
    Last edited: Jun 10, 2020
    Stamamarti likes this.
  7. Thank you Zen, I surely will give it a trial!
     
  8. 'pip' is not something you run from a Python shell; it's a program that you run from the commandline.
     
  9. Thank you !!! It worked very well.
     
    zenlot likes this.