Giter Site home page Giter Site logo

Comments (15)

thrasibule avatar thrasibule commented on June 11, 2024

It's probably a missing path issue somewhere in setup.py. In date.cpp do you have a line saying #include "ql/time/date.hpp" ?
And what's the compiler command used to compile date.cpp? If it contains -I/usr/local/include this should compile fine.

from pyql.

michaelnowotny avatar michaelnowotny commented on June 11, 2024

Yes, on line 620 in date.cpp, I have the following include:
#include "ql/time/date.hpp"

The compiler command is as follows (from a different machine with MacOS on which I get the same error):
building 'quantlib.time.date' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/michaelnowotny/anaconda/include -arch x86_64 -I/Users/michaelnowotny/anaconda/include -arch x86_64 -I/usr/local/include -I. -I../sources/boost_1_55_0 -I./cpp_layer -I/Users/michaelnowotny/anaconda/lib/python3.6/site-packages/numpy/core/include -I/Users/michaelnowotny/anaconda/include/python3.6m -c quantlib/time/date.cpp -o build/temp.macosx-10.7-x86_64-3.6/quantlib/time/date.o

from pyql.

dpinte avatar dpinte commented on June 11, 2024

Any chance that you haven't defined QL_HIGH_RESOLUTION_DATE ? That would explain why the intraday part of the dates are not defined.

from pyql.

thrasibule avatar thrasibule commented on June 11, 2024

@dpinte is right of course, this must be the issue. You need to configure quantlib with --enable-intraday, same as issue #200

from pyql.

michaelnowotny avatar michaelnowotny commented on June 11, 2024

Thank you very much for your advice @thrasibule and @dpinte!

I had indeed not defined this option. The name of the option in homebrew is "--with-intraday" (rather than "--enable-intraday") and this enables QL_HIGH_RESOLUTION_DATE. The compilation goes through, but when running the unit tests via
"make tests3" or "make tests"
I get a segmentation fault:

python -m unittest discover -v
make: *** [tests] Segmentation fault: 11

This happens on two macs I have tried it on (one with Sierra and the other one with High Sierra).

Any idea what might be causing this?

Thanks,

Michael

from pyql.

michaelnowotny avatar michaelnowotny commented on June 11, 2024

BTW: I am getting these clang warnings when compiling pyql:

clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: warning: object file (build/temp.macosx-10.7-x86_64-3.6/quantlib/time_series.o) was built for newer OSX version (10.7) than being linked (10.6)

from pyql.

thrasibule avatar thrasibule commented on June 11, 2024

The segfaults happens right away?? no tests at all go through?
From the directory you compiled pyql can you import quantlib at least? For instance try something like that.

from quantlib.time.date import today
today()

from pyql.

michaelnowotny avatar michaelnowotny commented on June 11, 2024

If I run the code above in the Python interpreter, I get the following error:

from quantlib.time.date import today
Traceback (most recent call last):
File "", line 1, in
ImportError: dlopen(/Volumes/GIT/pyql/quantlib/time/date.cpython-36m-darwin.so, 2): Symbol not found: _ZN8QuantLib10DateParser14parseFormattedERKSsS2
Referenced from: /Volumes/GIT/pyql/quantlib/time/date.cpython-36m-darwin.so
Expected in: flat namespace
in /Volumes/GIT/pyql/quantlib/time/date.cpython-36m-darwin.so

This happens on both Macs. I am going to try this on a third Mac which has Python installed via homebrew rather than Anaconda.

from pyql.

michaelnowotny avatar michaelnowotny commented on June 11, 2024

Ok, unit tests are running on the third Mac that does not use Anaconda. I am getting the same clang warnings:

clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: warning: object file (build/temp.macosx-10.13-x86_64-3.6/quantlib/time/calendars/united_states.o) was built for newer OSX version (10.13) than being linked (10.6)

So these can not be causing the problem on the other computers. Any ideas what can be going on?

from pyql.

michaelnowotny avatar michaelnowotny commented on June 11, 2024

A few unit tests are failing but this is likely not connected:

======================================================================
ERROR: test_zero_rate (quantlib.test.test_mlab.MLabTestCase)

Traceback (most recent call last):
File "/Volumes/GIT/pyql/quantlib/test/test_mlab.py", line 198, in test_zero_rate
maturity_dates=None)
File "/Volumes/GIT/pyql/quantlib/mlab/term_structure.py", line 68, in zbt_libor_yield
calendar=TARGET())
File "quantlib/time/schedule.pyx", line 63, in quantlib.time.schedule.Schedule.init
self._thisptr = new _schedule.Schedule(
RuntimeError: null termination date

======================================================================
ERROR: test_bump_yieldcurve (quantlib.test.test_piecewise_yield_curve.PiecewiseYieldCurveTestCase)

Traceback (most recent call last):
File "/Volumes/GIT/pyql/quantlib/test/test_piecewise_yield_curve.py", line 154, in test_bump_yieldcurve
old_discount = ts.discount(ts.max_date)
File "quantlib/termstructures/yield_term_structure.pyx", line 161, in quantlib.termstructures.yield_term_structure.YieldTermStructure.discount
discount_value = term_structure.discount(
RuntimeError: year 1900 out of bound. It must be in [1901,2199]

======================================================================
FAIL: test_extrapolation (quantlib.test.test_zero_coupon.ZeroCouponTestCase)

Traceback (most recent call last):
File "/Volumes/GIT/pyql/quantlib/test/test_zero_coupon.py", line 110, in test_extrapolation
"1st iteration: failed at 2nd alive instrument"))
AssertionError: False is not true


from pyql.

dpinte avatar dpinte commented on June 11, 2024

@michaelnowotny do you know how brew build quantlib? You need to make sure it has been built with -stdlib=libc++ -mmacosx-version-min=10.9 (see http://www.quantlib.org/install/macosx.shtml) and same when building pyql.

This message seem to indicate it's not the case:

clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: warning: object file (build/temp.macosx-10.7-x86_64-3.6/quantlib/time_series.o) was built for newer OSX version (10.7) than being linked (10.6)

from pyql.

michaelnowotny avatar michaelnowotny commented on June 11, 2024

Hi @dpinte,

I do not know specifically know how quantlib is built in homebrew. The clang error message appears on all three macs I have tried it, including the one where everything works. The issue seems to be related to Anaconda. The issue appears on both computers which use Anaconda.

Furthermore, I have uninstalled Anaconda on one of the Macs and installed Python via hombrew. After that everything works. So there must be some issue with Anaconda. I will uninstall Python from homebrew and reinstall Anaconda. Who knows, perhaps the installation had been referring to an out-of-date compiler, even though I kept conda up-to-date.

But at this point, the problem seems to be unlikely to be causes by pyql or quantlib.

Thank you both for your help!

Michael

from pyql.

michaelnowotny avatar michaelnowotny commented on June 11, 2024

Installed Anaconda again from scratch and the segmentation fault reappears. This is very likely an issue with Anaconda on the Mac.

from pyql.

dpinte avatar dpinte commented on June 11, 2024

@michaelnowotny I can suggest using edm which is known to work as expected (https://www.enthought.com/product/enthought-deployment-manager).

from pyql.

michaelnowotny avatar michaelnowotny commented on June 11, 2024

Thank you @dpinte. I will take a closer look. It is currently not clear to me if this will work with Anaconda or is an alternative to Anaconda. For the time being, I can simply keep using hombrew on Mac.

Thanks again for your help!

from pyql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.