certsocietegenerale / fame_modules

Community modules for FAME
https://certsocietegenerale.github.io/fame/
GNU General Public License v3.0
64 stars 41 forks source link

`stringsifter` module doesn't work when using python>=3.8 #77

Closed Augustin-FL closed 1 year ago

Augustin-FL commented 1 year ago

stringsifter module is currently not working using python>=3.8

Instead, the module is crashing with the following error:

Traceback (most recent call last):
  File "/opt/fame/env/bin/rank_strings", line 8, in <module>
    sys.exit(argmain())
  File "/opt/fame/env/lib/python3.9/site-packages/stringsifter/rank_strings.py", line 140, in argmain
    main(args.input_strings, args.limit, args.min_score,
  File "/opt/fame/env/lib/python3.9/site-packages/stringsifter/rank_strings.py", line 28, in main
    featurizer = joblib.load(os.path.join(modeldir, "featurizer.pkl"))
  File "/opt/fame/env/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 585, in load
    obj = _unpickle(fobj, filename, mmap_mode)
  File "/opt/fame/env/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 504, in _unpickle
    obj = unpickler.load()
  File "/usr/lib/python3.9/pickle.py", line 1212, in load
    dispatch[key[0]](self)
  File "/usr/lib/python3.9/pickle.py", line 1537, in load_stack_global
    self.append(self.find_class(module, name))
  File "/usr/lib/python3.9/pickle.py", line 1579, in find_class
    __import__(module, level=0)
  File "/opt/fame/env/lib/python3.9/site-packages/stringsifter/preprocess.py", line 16, in <module>
    import sklearn.feature_extraction.text
  File "/opt/fame/env/lib/python3.9/site-packages/sklearn/feature_extraction/__init__.py", line 9, in <module>
    from .image import img_to_graph, grid_to_graph
  File "/opt/fame/env/lib/python3.9/site-packages/sklearn/feature_extraction/image.py", line 172, in <module>
    dtype=np.int):
  File "/opt/fame/env/lib/python3.9/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Traceback (most recent call last):
  File "/opt/fame/env/bin/flarestrings", line 8, in <module>
    sys.exit(main())
  File "/opt/fame/env/lib/python3.9/site-packages/stringsifter/flarestrings.py", line 35, in main
    print(match.group().decode('ascii'))
BrokenPipeError: [Errno 32] Broken pipe

This error message seems due to an incorrect numpy version being required in the module dependencies