sahandha / eif

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

Cant install eif on Py3.9 #30

Open psmgeelen opened 3 years ago

psmgeelen commented 3 years ago

Hi there,

First I want to mention that I love the extended Isolation forest. Its a great algorithm and has yielded success for me personally more often then not. I am trying to install it in a python 3.9 environment and the pip installation fails. The full error is printed out below. I work on a ubuntu 21.04 machine and installed the environment with conda. This might be entirely unrelated, but I had a similar issue with the KDEpy library, and it seems as if there are issues with cython or the syntax changes of python 3.9.

If I can pro-actively support this library, I am more then happy to.

regards

(ug-16-04-2021) tv@tv-desktop:~$ pip install eif
Collecting eif
  Using cached eif-2.0.2.tar.gz (1.6 MB)
Requirement already satisfied: numpy in ./anaconda3/envs/ug-16-04-2021/lib/python3.9/site-packages (from eif) (1.20.2)
Requirement already satisfied: cython in ./anaconda3/envs/ug-16-04-2021/lib/python3.9/site-packages (from eif) (0.29.23)
Building wheels for collected packages: eif
  Building wheel for eif (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/tv/anaconda3/envs/ug-16-04-2021/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o196o0b9/eif_7a59fee4c81c435c98e0405bce7f8a65/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o196o0b9/eif_7a59fee4c81c435c98e0405bce7f8a65/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-0nvsces6
       cwd: /tmp/pip-install-o196o0b9/eif_7a59fee4c81c435c98e0405bce7f8a65/
  Complete output (24 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  copying eif_old.py -> build/lib.linux-x86_64-3.9
  copying version.py -> build/lib.linux-x86_64-3.9
  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
  cythoning _eif.pyx to _eif.cpp
  building 'eif' extension
  creating build/temp.linux-x86_64-3.9
  gcc -pthread -B /home/tv/anaconda3/envs/ug-16-04-2021/compiler_compat -Wl,--sysroot=/ -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/tv/anaconda3/envs/ug-16-04-2021/include -fPIC -O2 -isystem /home/tv/anaconda3/envs/ug-16-04-2021/include -fPIC -I/home/tv/anaconda3/envs/ug-16-04-2021/lib/python3.9/site-packages/numpy/core/include -I/home/tv/anaconda3/envs/ug-16-04-2021/include/python3.9 -c _eif.cpp -o build/temp.linux-x86_64-3.9/_eif.o -Wcpp
  gcc: fatal error: cannot execute ‘cc1plus’: execvp: No such file or directory
  compilation terminated.
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for eif
  Running setup.py clean for eif
Failed to build eif
Installing collected packages: eif
    Running setup.py install for eif ... error
    ERROR: Command errored out with exit status 1:
     command: /home/tv/anaconda3/envs/ug-16-04-2021/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o196o0b9/eif_7a59fee4c81c435c98e0405bce7f8a65/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o196o0b9/eif_7a59fee4c81c435c98e0405bce7f8a65/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vgbpe2o1/install-record.txt --single-version-externally-managed --compile --install-headers /home/tv/anaconda3/envs/ug-16-04-2021/include/python3.9/eif
         cwd: /tmp/pip-install-o196o0b9/eif_7a59fee4c81c435c98e0405bce7f8a65/
    Complete output (24 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    copying eif_old.py -> build/lib.linux-x86_64-3.9
    copying version.py -> build/lib.linux-x86_64-3.9
    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
    skipping '_eif.cpp' Cython extension (up-to-date)
    building 'eif' extension
    creating build/temp.linux-x86_64-3.9
    gcc -pthread -B /home/tv/anaconda3/envs/ug-16-04-2021/compiler_compat -Wl,--sysroot=/ -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/tv/anaconda3/envs/ug-16-04-2021/include -fPIC -O2 -isystem /home/tv/anaconda3/envs/ug-16-04-2021/include -fPIC -I/home/tv/anaconda3/envs/ug-16-04-2021/lib/python3.9/site-packages/numpy/core/include -I/home/tv/anaconda3/envs/ug-16-04-2021/include/python3.9 -c _eif.cpp -o build/temp.linux-x86_64-3.9/_eif.o -Wcpp
    gcc: fatal error: cannot execute ‘cc1plus’: execvp: No such file or directory
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/tv/anaconda3/envs/ug-16-04-2021/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o196o0b9/eif_7a59fee4c81c435c98e0405bce7f8a65/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o196o0b9/eif_7a59fee4c81c435c98e0405bce7f8a65/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vgbpe2o1/install-record.txt --single-version-externally-managed --compile --install-headers /home/tv/anaconda3/envs/ug-16-04-2021/include/python3.9/eif Check the logs for full command output.
psmgeelen commented 3 years ago

Please mark as resolved.

I was missing the g++ dependency. So with sudo apt install g++ the matter was resolved. Thanks in advance!