delvelabs/batea

Issues installing batea

gbiagomba opened this issue · 4 comments

When i tried to install batea i got the below error and I am unsure why and I am running it on Darwin HQSML-1689616 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64

python3 setup.py sdist; pip3 install -r requirements.txt; pip3 install -e .;
running sdist
running egg_info
error: [Errno 13] Permission denied
Requirement already satisfied: defusedxml==0.6.0 in /usr/local/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (0.6.0)
Requirement already satisfied: numpy==1.17.2 in /usr/local/lib/python3.8/site-packages (from -r requirements.txt (line 2)) (1.17.2)
Requirement already satisfied: click==6.7 in /usr/local/lib/python3.8/site-packages (from -r requirements.txt (line 3)) (6.7)
Collecting scikit-learn==0.21.3
  Using cached scikit-learn-0.21.3.tar.gz (12.2 MB)
Processing /Users/gbiago909/Library/Caches/pip/wheels/5f/a4/f5/58f4823fa59f34b12e2ad34a5f05d443346f42aa486a4df1aa/pandas-0.25.0-cp38-cp38-macosx_10_15_x86_64.whl
Requirement already satisfied: scipy>=0.17.0 in /usr/local/lib/python3.8/site-packages (from scikit-learn==0.21.3->-r requirements.txt (line 4)) (1.5.2)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.8/site-packages (from scikit-learn==0.21.3->-r requirements.txt (line 4)) (0.16.0)
Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.8/site-packages (from pandas==0.25.0->-r requirements.txt (line 5)) (2020.1)
Requirement already satisfied: python-dateutil>=2.6.1 in /usr/local/lib/python3.8/site-packages (from pandas==0.25.0->-r requirements.txt (line 5)) (2.8.1)
Requirement already satisfied: six>=1.5 in /usr/local/Cellar/protobuf/3.12.4/libexec/lib/python3.8/site-packages (from python-dateutil>=2.6.1->pandas==0.25.0->-r requirements.txt (line 5)) (1.15.0)
Building wheels for collected packages: scikit-learn
  Building wheel for scikit-learn (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py'"'"'; __file__='"'"'/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-wheel-1_qd4w7j
       cwd: /private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/
  Complete output (28 lines):
  Partial import of sklearn during the build process.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py", line 290, in <module>
      setup_package()
    File "/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py", line 286, in setup_package
      setup(**metadata)
    File "/usr/local/lib/python3.8/site-packages/numpy/distutils/core.py", line 137, in setup
      config = configuration()
    File "/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py", line 174, in configuration
      config.add_subpackage('sklearn')
    File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 1033, in add_subpackage
      config_list = self.get_subpackage(subpackage_name, subpackage_path,
    File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 999, in get_subpackage
      config = self._get_configuration_from_setup_py(
    File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
      config = setup_module.configuration(*args)
    File "sklearn/setup.py", line 62, in configuration
      config.add_subpackage('utils')
    File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 1033, in add_subpackage
      config_list = self.get_subpackage(subpackage_name, subpackage_path,
    File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 999, in get_subpackage
      config = self._get_configuration_from_setup_py(
    File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
      config = setup_module.configuration(*args)
    File "sklearn/utils/setup.py", line 8, in configuration
      from Cython import Tempita
  ModuleNotFoundError: No module named 'Cython'
  ----------------------------------------
  ERROR: Failed building wheel for scikit-learn
  Running setup.py clean for scikit-learn
Failed to build scikit-learn
Installing collected packages: scikit-learn, pandas
    Running setup.py install for scikit-learn ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py'"'"'; __file__='"'"'/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-record-t3su3ll1/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/scikit-learn
         cwd: /private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/
    Complete output (28 lines):
    Partial import of sklearn during the build process.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py", line 290, in <module>
        setup_package()
      File "/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py", line 286, in setup_package
        setup(**metadata)
      File "/usr/local/lib/python3.8/site-packages/numpy/distutils/core.py", line 137, in setup
        config = configuration()
      File "/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py", line 174, in configuration
        config.add_subpackage('sklearn')
      File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 1033, in add_subpackage
        config_list = self.get_subpackage(subpackage_name, subpackage_path,
      File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 999, in get_subpackage
        config = self._get_configuration_from_setup_py(
      File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "sklearn/setup.py", line 62, in configuration
        config.add_subpackage('utils')
      File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 1033, in add_subpackage
        config_list = self.get_subpackage(subpackage_name, subpackage_path,
      File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 999, in get_subpackage
        config = self._get_configuration_from_setup_py(
      File "/usr/local/lib/python3.8/site-packages/numpy/distutils/misc_util.py", line 941, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "sklearn/utils/setup.py", line 8, in configuration
        from Cython import Tempita
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py'"'"'; __file__='"'"'/private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-install-vxaj13m8/scikit-learn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/j5/t3kln5r959vc5bfr4hp20vmh0000gn/T/pip-record-t3su3ll1/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.8/scikit-learn Check the logs for full command output.
Obtaining file:///opt/batea
Requirement already satisfied: defusedxml==0.6.0 in /usr/local/lib/python3.8/site-packages (from batea==0.0.1) (0.6.0)
Installing collected packages: batea
  Attempting uninstall: batea
    Found existing installation: batea 0.0.1
    Uninstalling batea-0.0.1:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.8/site-packages/easy-install.pth'
Consider using the `--user` option or check the permissions.

Output from when i tru to run it

Traceback (most recent call last):
  File "/usr/local/bin/batea", line 33, in <module>
    sys.exit(load_entry_point('batea==0.0.1', 'console_scripts', 'batea')())
  File "/usr/local/bin/batea", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "/usr/local/lib/python3.8/site-packages/batea-0.0.1-py3.8.egg/batea/__init__.py", line 18, in <module>
ModuleNotFoundError: No module named 'batea.core'

I am having the same errors on my ubuntu server which i retuned to be like kali Linux kali 4.15.0-118-generic #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020 x86_64 GNU/Linux

@SergeOlivierP quick question is there a docker version of this software?

Hi,

Did you try https://stackoverflow.com/questions/43982543/importerror-no-module-named-cython ?

Maybe there is a version requirement on Cython for scikit-learn. Probably that having a dockerrized version would help, i'll push somthing out.

I have updated the dependency versions, it should work now.

iT WORKS!

 batea -h
Usage: batea [OPTIONS] [NMAP_REPORTS]...

  Context-driven asset ranking based using anomaly detection

Options:
  -c, --read-csv FILENAME
  -x, --read-xml FILENAME
  -n, --n-output INTEGER
  -A, --output-all
  -L, --load-model FILENAME
  -D, --dump-model FILENAME
  -f, --input-format TEXT
  -v, --verbose
  -oM, --output-matrix FILENAME
  -h, --help                     Show this message and exit.