theochem / horton

HORTON: Helpful Open-source Research TOol for N-fermion systems
http://theochem.github.io/horton/
GNU General Public License v3.0
92 stars 40 forks source link

cython error when building horton-2.1.0 on Mac OS High Sierra #285

Closed HugoStrand closed 5 years ago

HugoStrand commented 5 years ago

Dear all,

I am trying to build Horton (v2.1.0) on Mac OS High Sierra, first using MacPorts and then using the current master branch. In both cases I get an error during the "cythonization" of horton/gbasis/cext.pyx, see below.

I suspect that there is some problem with my setup since the pattern in the pyx file seems to be standard. I am using cython from MacPorts py27-cython @0.28.5_0.

Any ideas what I might be doing wrong?

Best regards, Hugo

For the whole build output please see: horton_build_output.txt

cythoning horton/gbasis/cext.pyx to horton/gbasis/cext.cpp

Error compiling Cython file:
------------------------------------------------------------
...
        cdef gbw.GB4IntegralWrapper* gb4w = NULL
        cdef vector[double]* vectors = NULL
        cdef np.npy_intp dims[3]
        cdef np.ndarray result

        cdef extern from "numpy/arrayobject.h":
            ^
------------------------------------------------------------

horton/gbasis/cext.pyx:983:13: Compiler crash in AnalyseDeclarationsTransform

ModuleNode.body = StatListNode(cext.pyx:24:0)
StatListNode.stats[39] = StatListNode(cext.pyx:648:5)
StatListNode.stats[0] = CClassDefNode(cext.pyx:648:5,
    as_name = u'GOBasis',
    class_name = u'GOBasis',
    module_name = u'',
    visibility = u'private')
CClassDefNode.body = StatListNode(cext.pyx:649:4)
StatListNode.stats[12] = DefNode(cext.pyx:963:4,
    doc = u'Apply the Cholesky code to a given type of four-center integrals.\n\n        Parameters\n        ----------\n        gb4int\n            The object that can carry out four-center integrals.\n        threshold\n            The cutoff for the Cholesky decomposition.\n\n        Returns\n        -------\n        array : np.ndarray, shape(nvec, nbasis, nbasis), dtype=float\n            The Cholesky-decomposed four-center integrals\n        ',
    modifiers = [...]/0,
    name = u'_compute_cholesky',
    np_args_idx = [...]/0,
    num_required_args = 2,
    py_wrapper_required = True,
    reqd_kw_flags_cname = '0')
File 'Nodes.py', line 427, in analyse_declarations: StatListNode(cext.pyx:964:8,
    is_terminator = True)
File 'Nodes.py', line 495, in analyse_declarations: CDefExternNode(cext.pyx:983:13,
    include_file = u'numpy/arrayobject.h')

Compiler crash traceback from this point on:
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Cython/Compiler/Nodes.py", line 495, in analyse_declarations
    env.add_include_file(self.include_file, self.verbatim_include, late)
TypeError: add_include_file() takes exactly 2 arguments (4 given)
building 'horton.gbasis.cext' extension
tovrstra commented 5 years ago

It seems that you are hitting a bug in Cython. Our extension is crashing the Cython compiler, without giving any understandable output on what is going wrong.

Could you try rolling back to an older version of Cython, to see in which Cython release the problem was introduced? (We've hit another bug in Cython some time ago and the only solution was to blacklist that Cython version.)

tovrstra commented 5 years ago

I just checked the Cython issue tracker and there are several comparable open issues with Compiler crash in AnalyseDeclarationsTransform but none of them seem directly related.

tovrstra commented 5 years ago

It seems that all 0.28.* versions of Cython have this problem. The most recent working one is 0.27.3.

HugoStrand commented 5 years ago

Dear Toon,

Thank you for the help. I rolled back to cython-0.27.3 and tried to build, but then I hit the index_wrap issue #282. Rolling back all the way to cython-0.25.2 solves the issue for horton-2.1.0.

Cheers, Hugo

tovrstra commented 5 years ago

I just made a bugfix release (horton 2.1.1) that should compile with the latest Cython version.