|
From: Jack G <jac...@gm...> - 2020-10-03 13:01:43
|
Dear Luigi, Many thanks for the help! I'm pleased to say I finally got it to work. In case others struggle with this in future, here was what I did (this is running on a reasonably new, mid-range Windows 10 laptop): 1) Built an ubuntu docker image with the QuantLib 1.19 binaries installed, following the instructions here: https://www.quantlib.org/install/linux.shtml - this was a slow step and took many hours to build (I left it running overnight). It also ended up around 17GB, I'm looking to improve on this by using one of Luigi's docker images in future (https://github.com/lballabio/dockerfiles). 2) I build a second image on top of this that git cloned down the 'binder' branch of my fork of the https://github.com/lballabio/QuantLib-SWIG repository (I found binder was important to make sure QuantLib and QuantLib-SWIG both matched version at 1.19). It is also important that this is not cloned down into a shared windows-docker drive, or else the bash scripts won't run correctly (something to do with line endings?), but is cloned directly into a folder inside the ubuntu image. This image also had a jupyter notebook server running in it (which I later use to test the code). 3) Once that was done, I built a container from the second image via docker-compose (I added 'mem_limit: 4096m' to up the memory limits, but I'm not sure if this helped in the end, now it's part of my cargo cult). I bashed into the container, navigated to the repo that I'd cloned down, and made the changes I had in mine to the SWIG .i files (the first time round, I made no changes - and I ran a new container for each set of changes I wanted to test) 4) Then I ran the following in the repo's top directory (nb. I had python3 only, installed in '/usr/bin/python3'): > ./autogen.sh > ./configure PYTHON=/usr/bin/python3 CXXFLAGS='-O0' > make -C Python <-- slow step, took approx 10 mins > sudo make -C Python install 5) After this, I could import QuantLib into my jupyter notebooks, and any changes I'd make to the SWIG interfaces was visible in the code. On one occasion when I omitted a comma in a C++ script, the procedure above broke a few seconds in to the 'make -C Python' step above. Once again, thanks for the support. Best, Jack On Fri, Oct 2, 2020 at 7:11 PM Luigi Ballabio <lui...@gm...> wrote: > It sounds like you're running out of memory. How much did you make > available to Docker? If that's the problem, you can try reducing the > amount of memory used by the compiler by disabling some or all > optimizations, i.e., by passing '-O1' or '-O0'. You can do that by setting > the environment variable CXXFLAGS to the desired flag. > > Luigi > > > On Fri, Oct 2, 2020 at 11:25 AM Jack G <jac...@gm...> wrote: > >> Dear Luigi, >> >> Thanks for coming back. The configure problem turned out to be dos/unix >> related - I was git cloning the files onto windows and sharing the volume >> within my container, which made ubuntu unhappy. When I git clone directly >> into the ubuntu container, all problems with that step are resolved. >> >> However, I'm still having trouble at the build step. I encounter this >> issue at the "make -C Python" command, and also cd'ing into the Python >> folder and following your instructions to build via python (here: >> https://github.com/lballabio/QuantLib-SWIG/blob/master/Python/README.txt) >> when I run this command "python setup.py build". In each case, I see a >> lot of deprecation warnings ending with one for "FDDividendAmericanEngine" >> (I've attached the full output of my most recent attempt >> in swig_stack_output.txt), followed by a very long delay. At this point >> nothing happens for a very long time, in one case it eventually failed due >> to virtual memory running out but on other occasions it stayed at this step >> for many hours: >> [image: image.png] >> >> I've tried my own docker image, and I also tried the same using a >> Dockerfile borrowed from one of your repos (I built this dockerfile >> https://github.com/lballabio/dockerfiles/blob/master/quantlib-swig-devenv/Dockerfile.python3, >> then ran an image, installed git and cloned the QuantLib-SWIG repo's >> 'binder' branch, then followed the instructions). >> >> I feel like I'm missing something but can't see what it might be. >> >> Thanks for the help, >> Jack >> >> On Fri, Oct 2, 2020 at 4:44 PM Luigi Ballabio <lui...@gm...> >> wrote: >> >>> Hello Jack, >>> may you post the full output from running configure? >>> >>> Luigi >>> >>> >>> On Thu, Oct 1, 2020 at 4:03 AM Jack G <jac...@gm...> wrote: >>> >>>> Dear QuantLib Users, >>>> >>>> I'm trying to install QuantLib-SWIG version 1.19 to add some additional >>>> interfaces into the C++ QuantLib functionality for use in Python, using the >>>> instructions here: https://www.quantlib.org/install/linux-python.shtml, >>>> and facing two problems. >>>> >>>> I'm developing inside a ubuntu docker container on a windows machine, >>>> and built QuantLib from source in the Dockerfile (it causes my image to be >>>> 17GB, not sure if this is expected?). I'm quite experienced with Python but >>>> not very experienced building C++. >>>> >>>> First I tried to compile from the git repo, I cloned down a version and >>>> ran ./autogen.sh, followed by ./configure, which gives the following error: >>>> [image: image.png] >>>> >>>> If I instead download the binary here >>>> https://bintray.com/quantlib/releases/download_file?file_path=QuantLib-SWIG-1.19.tar.gz >>>> and unzip, I can successfully run the ./configure step (note that as far as >>>> I can see, these two configure files are identical - compared via git). >>>> However I run into some trouble a little later. When I first run "make -C >>>> Python" or any step featuring "make", it tells me there is nothing to do. >>>> I'm able to fix this with "make clean" and then "make -C Python", then I >>>> have to "make clean" again but I get the following error again when I try >>>> to run "sudo make -C Python install", which (I think) builds/links the C++ >>>> code but is saying it doesn't want to install the python: >>>> [image: image.png] >>>> >>>> Am I doing something obviously wrong? My preference would be to install >>>> from the repo as I plan to test some code changes, but I'm not having much >>>> luck with it. If I instead unpack the binaries (in which I can see the code >>>> as text in .i files in the SWIG directory), modify the code, and then >>>> build, will that see and compile my changes? >>>> >>>> Thanks >>>> Jack >>>> _______________________________________________ >>>> QuantLib-users mailing list >>>> Qua...@li... >>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>>> >>> |