sahandha / eif

Extended Isolation Forest for Anomaly Detection
Other
445 stars 117 forks source link

Installation issue -- cython error #38

Open karimintel opened 2 months ago

karimintel commented 2 months ago

Hello,

I'm trying to install eif in python 3.9 env. but i'm getting the following errors. Any help will be appreciated.

Thanks!

Collecting eif Using cached eif-2.0.2.tar.gz (1.6 MB) Preparing metadata (setup.py) ... done Requirement already satisfied: numpy in /opt/intel/oneapi/intelpython/python3.9/lib/python3.9/site-packages (from eif) (1.26.4) Requirement already satisfied: cython in /opt/intel/oneapi/intelpython/python3.9/lib/python3.9/site-packages (from eif) (3.0.8) Building wheels for collected packages: eif Building wheel for eif (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [95 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-cpython-39 copying eif_old.py -> build/lib.linux-x86_64-cpython-39 copying version.py -> build/lib.linux-x86_64-cpython-39 running egg_info writing eif.egg-info/PKG-INFO writing dependency_links to eif.egg-info/dependency_links.txt writing requirements to eif.egg-info/requires.txt writing top-level names to eif.egg-info/top_level.txt reading manifest file 'eif.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'Readme.md' writing manifest file 'eif.egg-info/SOURCES.txt' running build_ext Compiling _eif.pyx because it changed. [1/1] Cythonizing _eif.pyx warning: _eif.pyx:12:8: Global name __eif matched from within class scope in contradiction to to Python 'class private name' rules. This may change in a future release. warning: _eif.pyx:12:8: Global name __eif matched from within class scope in contradiction to to Python 'class private name' rules. This may change in a future release.

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      @cython.boundscheck(False)
      @cython.wraparound(False)
      def __cinit__ (self, np.ndarray[double, ndim=2] X not None, int ntrees, int sample_size, int limit=0, int ExtensionLevel=0, int seed=-1):
          if ExtensionLevel < 0:
              raise Exception("Wrong Extension")
          self.thisptr = new __eif.iForest (ntrees, sample_size, limit, ExtensionLevel, seed)
                         ^
  ------------------------------------------------------------

  _eif.pyx:31:23: Operation only allowed in c++

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      @property
      def limit(self):
          return self._limit

      def __dealloc__ (self):
          del self.thisptr
          ^
  ------------------------------------------------------------

  _eif.pyx:51:8: Operation only allowed in c++
  Traceback (most recent call last):
karimintel commented 2 months ago

Saw a similar issue raised by [psmgeelen] in May 2021. I installed g++ but still getting the same errors.