EvgeniDubov / hellinger-distance-criterion

Random Forest model using Hellinger Distance as split criterion
BSD 3-Clause "New" or "Revised" License
31 stars 12 forks source link

Unable to install in Python on Mac #8

Open kinzafaiyaz opened 3 years ago

kinzafaiyaz commented 3 years ago

Hello. I am fairly new to using Github and Python. I am getting following error. Can anyone please guide me?

% pip install git+git://github.com/EvgeniDubov/hellinger-distance-criterion.git Collecting git+git://github.com/EvgeniDubov/hellinger-distance-criterion.git Cloning git://github.com/EvgeniDubov/hellinger-distance-criterion.git to /private/var/folders/xc/d_3wdbn161z1bplfv1860nww0000gn/T/pip-req-build-fbxmn23c ERROR: Command errored out with exit status 1: command: /Users/kinzafaiyaz/.pyenv/versions/3.9.0/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xc/d_3wdbn161z1bplfv1860nww0000gn/T/pip-req-build-fbxmn23c/setup.py'"'"'; file='"'"'/private/var/folders/xc/d_3wdbn161z1bplfv1860nww0000gn/T/pip-req-build-fbxmn23c/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/xc/d_3wdbn161z1bplfv1860nww0000gn/T/pip-pip-egg-info-exk_jlqb cwd: /private/var/folders/xc/d_3wdbn161z1bplfv1860nww0000gn/T/pip-req-build-fbxmn23c/ Complete output (713 lines): /Users/kinzafaiyaz/.pyenv/versions/3.9.0/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/xc/d_3wdbn161z1bplfv1860nww0000gn/T/pip-req-build-fbxmn23c/hellinger_distance_criterion.pyx tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file:
------------------------------------------------------------
...

# Author: Evgeni Dubov <evgeni.dubov@gmail.com>
#
# License: MIT

from sklearn.tree._criterion cimport ClassificationCriterion
^
------------------------------------------------------------

hellinger_distance_criterion.pyx:6:0: 'sklearn/tree/_criterion.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...

# Author: Evgeni Dubov <evgeni.dubov@gmail.com>
#
# License: MIT

from sklearn.tree._criterion cimport ClassificationCriterion
^
------------------------------------------------------------

hellinger_distance_criterion.pyx:6:0: 'sklearn/tree/_criterion/ClassificationCriterion.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
# Author: Evgeni Dubov <evgeni.dubov@gmail.com>
#
# License: MIT

from sklearn.tree._criterion cimport ClassificationCriterion
from sklearn.tree._criterion cimport SIZE_t
^
------------------------------------------------------------

hellinger_distance_criterion.pyx:7:0: 'sklearn/tree/_criterion/SIZE_t.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...

from libc.math cimport sqrt, pow
from libc.math cimport abs

cdef class HellingerDistanceCriterion(ClassificationCriterion):
                                     ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:16:38: First base of 'HellingerDistanceCriterion' is not an extension type

Error compiling Cython file:
------------------------------------------------------------
...
        self.children_impurity(&impurity_left, &impurity_right)

        return impurity_right + impurity_left

    cdef double node_impurity(self) nogil:
        cdef SIZE_t* n_classes = self.n_classes
            ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:35:13: 'SIZE_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        cdef SIZE_t* n_classes = self.n_classes
        cdef double* sum_total = self.sum_total
        cdef double hellinger = 0.0
        cdef double sq_count
        cdef double count_k
        cdef SIZE_t k
            ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:40:13: 'SIZE_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double* sum_total = self.sum_total
        cdef double hellinger = 0.0
        cdef double sq_count
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c
            ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:41:13: 'SIZE_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

        return hellinger / self.n_outputs

    cdef void children_impurity(self, double* impurity_left,
                                double* impurity_right) nogil:
        cdef SIZE_t* n_classes = self.n_classes
            ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:51:13: 'SIZE_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double hellinger_left = 0.0
        cdef double hellinger_right = 0.0
        cdef double count_k1 = 0.0
        cdef double count_k2 = 0.0

        cdef SIZE_t k
            ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:59:13: 'SIZE_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double hellinger_right = 0.0
        cdef double count_k1 = 0.0
        cdef double count_k2 = 0.0

        cdef SIZE_t k
        cdef SIZE_t c
            ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:60:13: 'SIZE_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

        return impurity_right + impurity_left

    cdef double node_impurity(self) nogil:
        cdef SIZE_t* n_classes = self.n_classes
        cdef double* sum_total = self.sum_total
                                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:36:37: Cannot convert Python object to 'double *'

Error compiling Cython file:
------------------------------------------------------------
...
        return hellinger / self.n_outputs

    cdef void children_impurity(self, double* impurity_left,
                                double* impurity_right) nogil:
        cdef SIZE_t* n_classes = self.n_classes
        cdef double* sum_left = self.sum_left
                                   ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:52:36: Cannot convert Python object to 'double *'

Error compiling Cython file:
------------------------------------------------------------
...

    cdef void children_impurity(self, double* impurity_left,
                                double* impurity_right) nogil:
        cdef SIZE_t* n_classes = self.n_classes
        cdef double* sum_left = self.sum_left
        cdef double* sum_right = self.sum_right
                                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:53:37: Cannot convert Python object to 'double *'

Error compiling Cython file:
------------------------------------------------------------
...
        self.children_impurity(&impurity_left, &impurity_right)

        return impurity_right + impurity_left

    cdef double node_impurity(self) nogil:
        cdef SIZE_t* n_classes = self.n_classes
                                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:35:37: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...
        self.children_impurity(&impurity_left, &impurity_right)

        return impurity_right + impurity_left

    cdef double node_impurity(self) nogil:
        cdef SIZE_t* n_classes = self.n_classes
                                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:35:37: Accessing Python attribute not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...

        return impurity_right + impurity_left

    cdef double node_impurity(self) nogil:
        cdef SIZE_t* n_classes = self.n_classes
        cdef double* sum_total = self.sum_total
                                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:36:37: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...

        return impurity_right + impurity_left

    cdef double node_impurity(self) nogil:
        cdef SIZE_t* n_classes = self.n_classes
        cdef double* sum_total = self.sum_total
                                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:36:37: Accessing Python attribute not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double sq_count
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c

        for k in range(self.n_outputs):
                ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:43:17: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double sq_count
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c

        for k in range(self.n_outputs):
                ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:43:17: Iterating over Python object not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double sq_count
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c

        for k in range(self.n_outputs):
                     ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:43:22: Calling gil-requiring function not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double sq_count
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c

        for k in range(self.n_outputs):
                     ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:43:22: Constructing Python tuple not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double sq_count
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c

        for k in range(self.n_outputs):
                          ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:43:27: Accessing Python attribute not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c

        for k in range(self.n_outputs):
            for c in range(n_classes[k]):
                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:44:21: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c

        for k in range(self.n_outputs):
            for c in range(n_classes[k]):
                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:44:21: Iterating over Python object not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c

        for k in range(self.n_outputs):
            for c in range(n_classes[k]):
                         ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:44:26: Calling gil-requiring function not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c

        for k in range(self.n_outputs):
            for c in range(n_classes[k]):
                         ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:44:26: Constructing Python tuple not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        cdef double count_k
        cdef SIZE_t k
        cdef SIZE_t c

        for k in range(self.n_outputs):
            for c in range(n_classes[k]):
                                   ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:44:36: Converting to Python object not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...

        for k in range(self.n_outputs):
            for c in range(n_classes[k]):
                hellinger += 1.0

        return hellinger / self.n_outputs
                        ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:47:25: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...

        for k in range(self.n_outputs):
            for c in range(n_classes[k]):
                hellinger += 1.0

        return hellinger / self.n_outputs
                        ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:47:25: Operation not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...

        for k in range(self.n_outputs):
            for c in range(n_classes[k]):
                hellinger += 1.0

        return hellinger / self.n_outputs
              ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:47:15: Converting to Python object not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...

        for k in range(self.n_outputs):
            for c in range(n_classes[k]):
                hellinger += 1.0

        return hellinger / self.n_outputs
                              ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:47:31: Accessing Python attribute not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...

        return hellinger / self.n_outputs

    cdef void children_impurity(self, double* impurity_left,
                                double* impurity_right) nogil:
        cdef SIZE_t* n_classes = self.n_classes
                                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:51:37: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...

        return hellinger / self.n_outputs

    cdef void children_impurity(self, double* impurity_left,
                                double* impurity_right) nogil:
        cdef SIZE_t* n_classes = self.n_classes
                                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:51:37: Accessing Python attribute not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        return hellinger / self.n_outputs

    cdef void children_impurity(self, double* impurity_left,
                                double* impurity_right) nogil:
        cdef SIZE_t* n_classes = self.n_classes
        cdef double* sum_left = self.sum_left
                                   ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:52:36: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...
        return hellinger / self.n_outputs

    cdef void children_impurity(self, double* impurity_left,
                                double* impurity_right) nogil:
        cdef SIZE_t* n_classes = self.n_classes
        cdef double* sum_left = self.sum_left
                                   ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:52:36: Accessing Python attribute not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...

    cdef void children_impurity(self, double* impurity_left,
                                double* impurity_right) nogil:
        cdef SIZE_t* n_classes = self.n_classes
        cdef double* sum_left = self.sum_left
        cdef double* sum_right = self.sum_right
                                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:53:37: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...

    cdef void children_impurity(self, double* impurity_left,
                                double* impurity_right) nogil:
        cdef SIZE_t* n_classes = self.n_classes
        cdef double* sum_left = self.sum_left
        cdef double* sum_right = self.sum_right
                                    ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:53:37: Accessing Python attribute not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        if sum_left[1] + sum_right[1] == 0:
            impurity_left[0] = -INFINITY
            impurity_right[0] = -INFINITY
            return

        for k in range(self.n_outputs):
                ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:68:17: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...
        if sum_left[1] + sum_right[1] == 0:
            impurity_left[0] = -INFINITY
            impurity_right[0] = -INFINITY
            return

        for k in range(self.n_outputs):
                ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:68:17: Iterating over Python object not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        if sum_left[1] + sum_right[1] == 0:
            impurity_left[0] = -INFINITY
            impurity_right[0] = -INFINITY
            return

        for k in range(self.n_outputs):
                     ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:68:22: Calling gil-requiring function not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        if sum_left[1] + sum_right[1] == 0:
            impurity_left[0] = -INFINITY
            impurity_right[0] = -INFINITY
            return

        for k in range(self.n_outputs):
                     ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:68:22: Constructing Python tuple not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
        if sum_left[1] + sum_right[1] == 0:
            impurity_left[0] = -INFINITY
            impurity_right[0] = -INFINITY
            return

        for k in range(self.n_outputs):
                          ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:68:27: Accessing Python attribute not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
            if(sum_left[1] + sum_right[1] > 0):
                count_k2 = sqrt(sum_right[1] / (sum_left[1] + sum_right[1]))

            hellinger_right += pow((count_k1  - count_k2),2)

        impurity_left[0]  = hellinger_left  / self.n_outputs
                                           ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:83:44: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...
            if(sum_left[1] + sum_right[1] > 0):
                count_k2 = sqrt(sum_right[1] / (sum_left[1] + sum_right[1]))

            hellinger_right += pow((count_k1  - count_k2),2)

        impurity_left[0]  = hellinger_left  / self.n_outputs
                                           ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:83:44: Operation not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
            if(sum_left[1] + sum_right[1] > 0):
                count_k2 = sqrt(sum_right[1] / (sum_left[1] + sum_right[1]))

            hellinger_right += pow((count_k1  - count_k2),2)

        impurity_left[0]  = hellinger_left  / self.n_outputs
                           ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:83:28: Converting to Python object not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
            if(sum_left[1] + sum_right[1] > 0):
                count_k2 = sqrt(sum_right[1] / (sum_left[1] + sum_right[1]))

            hellinger_right += pow((count_k1  - count_k2),2)

        impurity_left[0]  = hellinger_left  / self.n_outputs
                                                 ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:83:50: Accessing Python attribute not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
                count_k2 = sqrt(sum_right[1] / (sum_left[1] + sum_right[1]))

            hellinger_right += pow((count_k1  - count_k2),2)

        impurity_left[0]  = hellinger_left  / self.n_outputs
        impurity_right[0] = hellinger_right / self.n_outputs
                                           ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:84:44: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...
                count_k2 = sqrt(sum_right[1] / (sum_left[1] + sum_right[1]))

            hellinger_right += pow((count_k1  - count_k2),2)

        impurity_left[0]  = hellinger_left  / self.n_outputs
        impurity_right[0] = hellinger_right / self.n_outputs
                                           ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:84:44: Operation not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
                count_k2 = sqrt(sum_right[1] / (sum_left[1] + sum_right[1]))

            hellinger_right += pow((count_k1  - count_k2),2)

        impurity_left[0]  = hellinger_left  / self.n_outputs
        impurity_right[0] = hellinger_right / self.n_outputs
                           ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:84:28: Converting to Python object not allowed without gil

Error compiling Cython file:
------------------------------------------------------------
...
                count_k2 = sqrt(sum_right[1] / (sum_left[1] + sum_right[1]))

            hellinger_right += pow((count_k1  - count_k2),2)

        impurity_left[0]  = hellinger_left  / self.n_outputs
        impurity_right[0] = hellinger_right / self.n_outputs
                                                 ^
------------------------------------------------------------

hellinger_distance_criterion.pyx:84:50: Accessing Python attribute not allowed without gil
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/xc/d_3wdbn161z1bplfv1860nww0000gn/T/pip-req-build-fbxmn23c/setup.py", line 11, in <module>
    ext_modules=cythonize('hellinger_distance_criterion.pyx'),
  File "/Users/kinzafaiyaz/.pyenv/versions/3.9.0/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1102, in cythonize
    cythonize_one(*args)
  File "/Users/kinzafaiyaz/.pyenv/versions/3.9.0/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1225, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: hellinger_distance_criterion.pyx
Compiling hellinger_distance_criterion.pyx because it changed.
[1/1] Cythonizing hellinger_distance_criterion.pyx
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.