currentslab / extractnet

A fork of Dragnet that also extract author, headline, date, keywords from context, as well as built in metadata extraction all in one package
https://pypi.org/project/extractnet
MIT License
239 stars 22 forks source link

ImportError: undefined symbol: deflateInit2_ #16

Open midstreeeam opened 1 year ago

midstreeeam commented 1 year ago

Using python3.10 and got importError

Traceback (most recent call last):
  File "/home/midstream/git/peduncle/test.py", line 1, in <module>
    from extractnet import Extractor
  File "/home/midstream/.local/lib/python3.10/site-packages/extractnet/__init__.py", line 1, in <module>
    from extractnet.pipeline import Extractor
  File "/home/midstream/.local/lib/python3.10/site-packages/extractnet/pipeline.py", line 10, in <module>
    from .nn_models import NewsNet
  File "/home/midstream/.local/lib/python3.10/site-packages/extractnet/nn_models.py", line 7, in <module>
    from .blocks import TagCountReadabilityBlockifier
ImportError: /home/midstream/.local/lib/python3.10/site-packages/extractnet/blocks.cpython-310-x86_64-linux-gnu.so: undefined symbol: deflateInit2_
vgavro commented 11 months ago

Same using python3.8:

In [1]: import extractnet
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[1], line 1
----> 1 import extractnet

File ~/work/X/venv38/lib/python3.8/site-packages/extractnet/__init__.py:1
----> 1 from extractnet.pipeline import Extractor
      3 __version__ = '2.0.7'
      6 _LOADED_MODELS = {}

File ~/work/X/venv38/lib/python3.8/site-packages/extractnet/pipeline.py:10
      8 from .compat import unicode_
      9 from .util import priority_merge, get_module_res, remove_empty_keys, attribute_sanity_check
---> 10 from .nn_models import NewsNet
     11 from .name_crf import AuthorExtraction
     12 from .nn_models import NewsNet

File ~/work/X/venv38/lib/python3.8/site-packages/extractnet/nn_models.py:7
      5 from .compat import str_cast
      6 from .util import get_and_union_features, get_module_res, fix_encoding
----> 7 from .blocks import TagCountReadabilityBlockifier
      9 EMPTY_HTML = "<article><p>content</p><p>blocked</p><p>404</p></article>"
     11 class NewsNet():

ImportError: /home/vgavro/work/X/venv38/lib/python3.8/site-packages/extractnet/blocks.cpython-38-x86_64-linux-gnu.so: undefined symbol: deflateInit2_
vgavro commented 11 months ago

UPD: looks like pre-compiled libraries published on pypi and used from pypi install are not working on all linux systems because builded with shared libraries, you need to build package yourself, but build system was also broken. see #18 merge request, until merged use command below to install:

./venv/bin/pip install --upgrade 'git+https://github.com/vgavro/extractnet@fix/pip_build'
kungfucop commented 8 months ago

UPD: looks like pre-compiled libraries published on pypi and used from pypi install are not working on all linux systems because builded with shared libraries, you need to build package yourself, but build system was also broken. see #18 merge request, until merged use command below to install:

./venv/bin/pip install --upgrade 'git+https://github.com/vgavro/extractnet@fix/pip_build'

this works for me, thanks! Also I installed g++ libxml2-dev git to make the build.