Error running batea
Closed this issue · 1 comments
Hi, i have just tried to install and run the project, with or without sudo, and I am getting errors from numpy. I am running kali
`┌──(kali㉿kali)-[~/git/batea]
└─$ batea -v output.xml
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
File "/home/kali/.local/bin/batea", line 33, in
sys.exit(load_entry_point('batea', 'console_scripts', 'batea')())
File "/home/kali/.local/bin/batea", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 86, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 972, in _find_and_load_unlocked
File "", line 228, in _call_with_frames_removed
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/home/kali/git/batea/batea/init.py", line 18, in
from .core.nmap_parser import NmapReportParser
File "/home/kali/git/batea/batea/core/init.py", line 22, in
from .model import BateaModel
File "/home/kali/git/batea/batea/core/model.py", line 18, in
from sklearn.ensemble import IsolationForest
File "/home/kali/.local/lib/python3.9/site-packages/sklearn/init.py", line 80, in
from .base import clone
File "/home/kali/.local/lib/python3.9/site-packages/sklearn/base.py", line 21, in
from .utils import _IS_32BIT
File "/home/kali/.local/lib/python3.9/site-packages/sklearn/utils/init.py", line 20, in
from scipy.sparse import issparse
File "/usr/lib/python3/dist-packages/scipy/sparse/init.py", line 228, in
from .csr import *
File "/usr/lib/python3/dist-packages/scipy/sparse/csr.py", line 10, in
from ._sparsetools import (csr_tocsc, csr_tobsr, csr_count_blocks,
ImportError: numpy.core.multiarray failed to import
┌──(kali㉿kali)-[~/git/batea]
└─$ cd ..
┌──(kali㉿kali)-[~/git]
└─$ rm -rf batea
┌──(kali㉿kali)-[~/git]
└─$ git clone https://github.com/delvelabs/batea.git
Cloning into 'batea'...
remote: Enumerating objects: 258, done.
remote: Counting objects: 100% (68/68), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 258 (delta 59), reused 45 (delta 45), pack-reused 190
Receiving objects: 100% (258/258), 73.92 KiB | 764.00 KiB/s, done.
Resolving deltas: 100% (144/144), done.
┌──(kali㉿kali)-[~/git]
└─$ cd batea
┌──(kali㉿kali)-[~/git/batea]
└─$ sudo python3 setup.py sdist
[sudo] password for kali:
running sdist
running egg_info
creating batea.egg-info
writing batea.egg-info/PKG-INFO
writing dependency_links to batea.egg-info/dependency_links.txt
writing entry points to batea.egg-info/entry_points.txt
writing requirements to batea.egg-info/requires.txt
writing top-level names to batea.egg-info/top_level.txt
writing manifest file 'batea.egg-info/SOURCES.txt'
reading manifest file 'batea.egg-info/SOURCES.txt'
adding license file 'LICENSE.md'
writing manifest file 'batea.egg-info/SOURCES.txt'
running check
creating batea-0.0.1
creating batea-0.0.1/batea
creating batea-0.0.1/batea.egg-info
copying files to batea-0.0.1...
copying LICENSE.md -> batea-0.0.1
copying README.md -> batea-0.0.1
copying setup.cfg -> batea-0.0.1
copying setup.py -> batea-0.0.1
copying batea/init.py -> batea-0.0.1/batea
copying batea/main.py -> batea-0.0.1/batea
copying batea/version.py -> batea-0.0.1/batea
copying batea.egg-info/PKG-INFO -> batea-0.0.1/batea.egg-info
copying batea.egg-info/SOURCES.txt -> batea-0.0.1/batea.egg-info
copying batea.egg-info/dependency_links.txt -> batea-0.0.1/batea.egg-info
copying batea.egg-info/entry_points.txt -> batea-0.0.1/batea.egg-info
copying batea.egg-info/requires.txt -> batea-0.0.1/batea.egg-info
copying batea.egg-info/top_level.txt -> batea-0.0.1/batea.egg-info
Writing batea-0.0.1/setup.cfg
creating dist
Creating tar archive
removing 'batea-0.0.1' (and everything under it)
┌──(kali㉿kali)-[~/git/batea]
└─$ sudo pip3 install -r requirements.txt
Collecting defusedxml==0.6.0
Downloading defusedxml-0.6.0-py2.py3-none-any.whl (23 kB)
Collecting numpy==1.19.4
Downloading numpy-1.19.4-cp39-cp39-manylinux2010_x86_64.whl (14.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.5/14.5 MB 10.2 MB/s eta 0:00:00
Collecting click==7.1.2
Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.8/82.8 KB 15.0 MB/s eta 0:00:00
Collecting scikit-learn==0.23.2
Downloading scikit-learn-0.23.2.tar.gz (7.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.2/7.2 MB 9.4 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting pandas==1.1.4
Downloading pandas-1.1.4-cp39-cp39-manylinux1_x86_64.whl (9.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.3/9.3 MB 10.1 MB/s eta 0:00:00
Collecting joblib>=0.11
Downloading joblib-1.1.0-py2.py3-none-any.whl (306 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 307.0/307.0 KB 7.9 MB/s eta 0:00:00
Collecting threadpoolctl>=2.0.0
Downloading threadpoolctl-3.1.0-py3-none-any.whl (14 kB)
Requirement already satisfied: scipy>=0.19.1 in /usr/lib/python3/dist-packages (from scikit-learn==0.23.2->-r requirements.txt (line 4)) (1.7.3)
Requirement already satisfied: python-dateutil>=2.7.3 in /usr/lib/python3/dist-packages (from pandas==1.1.4->-r requirements.txt (line 5)) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in /usr/lib/python3/dist-packages (from pandas==1.1.4->-r requirements.txt (line 5)) (2022.1)
Building wheels for collected packages: scikit-learn
Building wheel for scikit-learn (pyproject.toml) ... done
Created wheel for scikit-learn: filename=scikit_learn-0.23.2-cp39-cp39-linux_x86_64.whl size=21712114 sha256=931033a0fc5847f2cf85d6f29d0aa88d849cf99df627e5b4a514a7316ececd6b
Stored in directory: /root/.cache/pip/wheels/5e/74/24/7e235ccf01765c0daa089c98cc823e9dc1383da5fe0ed7e224
Successfully built scikit-learn
Installing collected packages: threadpoolctl, numpy, joblib, defusedxml, click, scikit-learn, pandas
Attempting uninstall: numpy
Found existing installation: numpy 1.21.5
Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'numpy'. No files were found to uninstall.
Attempting uninstall: defusedxml
Found existing installation: defusedxml 0.7.1
Not uninstalling defusedxml at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'defusedxml'. No files were found to uninstall.
Attempting uninstall: click
Found existing installation: click 8.0.3
Not uninstalling click at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'click'. No files were found to uninstall.
Attempting uninstall: pandas
Found existing installation: pandas 1.3.5
Not uninstalling pandas at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'pandas'. No files were found to uninstall.
Successfully installed click-7.1.2 defusedxml-0.6.0 joblib-1.1.0 numpy-1.19.4 pandas-1.1.4 scikit-learn-0.23.2 threadpoolctl-3.1.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
┌──(kali㉿kali)-[~/git/batea]
└─$ sudo pip3 install -e .
Obtaining file:///home/kali/git/batea
Preparing metadata (setup.py) ... done
Requirement already satisfied: defusedxml==0.6.0 in /usr/local/lib/python3.9/dist-packages (from batea==0.0.1) (0.6.0)
Installing collected packages: batea
Running setup.py develop for batea
Successfully installed batea-0.0.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
┌──(kali㉿kali)-[~/git/batea]
└─$ cp ../../output.xml .
┌──(kali㉿kali)-[~/git/batea]
└─$ sudo batea -v output.xml
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
File "/usr/local/bin/batea", line 33, in
sys.exit(load_entry_point('batea', 'console_scripts', 'batea')())
File "/usr/local/bin/batea", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 86, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 972, in _find_and_load_unlocked
File "", line 228, in _call_with_frames_removed
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/home/kali/git/batea/batea/init.py", line 18, in
from .core.nmap_parser import NmapReportParser
File "/home/kali/git/batea/batea/core/init.py", line 22, in
from .model import BateaModel
File "/home/kali/git/batea/batea/core/model.py", line 18, in
from sklearn.ensemble import IsolationForest
File "/usr/local/lib/python3.9/dist-packages/sklearn/init.py", line 80, in
from .base import clone
File "/usr/local/lib/python3.9/dist-packages/sklearn/base.py", line 21, in
from .utils import _IS_32BIT
File "/usr/local/lib/python3.9/dist-packages/sklearn/utils/init.py", line 20, in
from scipy.sparse import issparse
File "/usr/lib/python3/dist-packages/scipy/sparse/init.py", line 228, in
from .csr import *
File "/usr/lib/python3/dist-packages/scipy/sparse/csr.py", line 10, in
from ._sparsetools import (csr_tocsc, csr_tobsr, csr_count_blocks,
ImportError: numpy.core.multiarray failed to import
┌──(kali㉿kali)-[~/git/batea]
└─$ lsb_release -r
Release: 2022.1
┌──(kali㉿kali)-[~/git/batea]
└─$ lsb_release -ra
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2022.1
Codename: kali-rolling
`
It looks like requirements process does not uninstall numpy version and install the good one, right?
but, if I check installed dependencies with required ones, I think I have no problem:
`┌──(kali㉿kali)-[~/git/batea]
└─$ cat requirements.txt
defusedxml==0.6.0
numpy==1.19.4
click==7.1.2
scikit-learn==0.23.2
pandas==1.1.4
┌──(kali㉿kali)-[~/git/batea]
└─$ python3 -m pip show numpy
Name: numpy
Version: 1.19.4
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email:
License: BSD
Location: /home/kali/.local/lib/python3.9/site-packages
Requires:
Required-by: ImageHash, pandas, PyWavelets, scikit-learn
┌──(kali㉿kali)-[~/git/batea]
└─$ python3 -m pip show defusedxml
Name: defusedxml
Version: 0.6.0
Summary: XML bomb protection for Python stdlib modules
Home-page: https://github.com/tiran/defusedxml
Author: Christian Heimes
Author-email: christian@python.org
License: PSFL
Location: /home/kali/.local/lib/python3.9/site-packages
Requires:
Required-by: batea
┌──(kali㉿kali)-[~/git/batea]
└─$ python3 -m pip show click
Name: click
Version: 7.1.2
Summary: Composable command line interface toolkit
Home-page: https://palletsprojects.com/p/click/
Author:
Author-email:
License: BSD-3-Clause
Location: /home/kali/.local/lib/python3.9/site-packages
Requires:
Required-by: uvicorn
┌──(kali㉿kali)-[~/git/batea]
└─$ python3 -m pip show scikit-learn
Name: scikit-learn
Version: 0.23.2
Summary: A set of python modules for machine learning and data mining
Home-page: http://scikit-learn.org
Author:
Author-email:
License: new BSD
Location: /home/kali/.local/lib/python3.9/site-packages
Requires: joblib, numpy, scipy, threadpoolctl
Required-by:
┌──(kali㉿kali)-[~/git/batea]
└─$ python3 -m pip show pandas
Name: pandas
Version: 1.1.4
Summary: Powerful data structures for data analysis, time series, and statistics
Home-page: https://pandas.pydata.org
Author:
Author-email:
License: BSD
Location: /home/kali/.local/lib/python3.9/site-packages
Requires: numpy, python-dateutil, pytz
Required-by:
`
so, could you help me please?
Ok, i answer myself:
`┌──(kali㉿kali)-[~/git/batea]
└─$ sudo pip3 install numpy --upgrade
[sudo] password for kali:
Requirement already satisfied: numpy in /usr/local/lib/python3.9/dist-packages (1.19.4)
Collecting numpy
Downloading numpy-1.22.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.8/16.8 MB 10.6 MB/s eta 0:00:00
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.19.4
Uninstalling numpy-1.19.4:
Successfully uninstalled numpy-1.19.4
Successfully installed numpy-1.22.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
┌──(kali㉿kali)-[~/git/batea]
└─$ sudo batea -v output.xml
{
"report_info": [
{
"number_of_hosts": 1,
"...
}
`