Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to import extractnet #15

Open
mbaxter opened this issue Jun 9, 2023 · 0 comments
Open

Unable to import extractnet #15

mbaxter opened this issue Jun 9, 2023 · 0 comments

Comments

@mbaxter
Copy link

mbaxter commented Jun 9, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant