extractnet icon indicating copy to clipboard operation
extractnet copied to clipboard

Unable to import extractnet

Open mbaxter opened this issue 2 years ago • 0 comments

Description

I'm getting an error when I try to import extractnet using the basic example code from the readme: ImportError: cannot import name 'Extractor' from partially initialized module 'extractnet'.

My code:

import requests
from extractnet import Extractor


def extract_content(url:str):
    raw_html = requests.get(url).text
    return Extractor().extract(raw_html)


if __name__ == "__main__":
    url = "https://currentsapi.services/en/blog/2019/03/27/python-microframework-benchmark/.html"
    content = extract_content(url)
    print(content)

Error:

<repo_path>/venv/bin/python <repo_path>/live_notes_txt_sources/core/html.py 
Traceback (most recent call last):
  File "<repo_path>/live_notes_txt_sources/core/html.py", line 1, in <module>
    from extractnet import Extractor
  File "<repo_path>/venv/lib/python3.10/site-packages/extractnet/__init__.py", line 1, in <module>
    from extractnet.pipeline import Extractor
  File "<repo_path>/venv/lib/python3.10/site-packages/extractnet/pipeline.py", line 5, in <module>
    from sklearn.base import BaseEstimator, ClassifierMixin
  File "<repo_path>/venv/lib/python3.10/site-packages/sklearn/__init__.py", line 82, in <module>
    from .base import clone
  File "<repo_path>/venv/lib/python3.10/site-packages/sklearn/base.py", line 17, in <module>
    from .utils import _IS_32BIT
  File "<repo_path>/venv/lib/python3.10/site-packages/sklearn/utils/__init__.py", line 26, in <module>
    from ._estimator_html_repr import estimator_html_repr
  File "<repo_path>/venv/lib/python3.10/site-packages/sklearn/utils/_estimator_html_repr.py", line 5, in <module>
    import html
  File "<repo_path>/live_notes_txt_sources/core/html.py", line 1, in <module>
    from extractnet import Extractor
ImportError: cannot import name 'Extractor' from partially initialized module 'extractnet' (most likely due to a circular import) (<repo_path>/venv/lib/python3.10/site-packages/extractnet/__init__.py)

Process finished with exit code 1

Python Version: 3.10.10 Library Version: 2.0.7 Platform: Mac OSX 13.2.1

mbaxter avatar Jun 09 '23 16:06 mbaxter