Search code examples
pythonpipimporterrorcircular-dependency

ImportError: cannot import name '_priv_parser', circular dependency


I struggled with this error on Pycharm, I'm using the BotCity framework and it wasn't barely starting running the script process when the following error was given:

> Traceback (most recent call last):
> 
> File "<frozen importlib._bootstrap>", line 1176, in _find_and_load  
> File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
> File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
> File "<frozen importlib._bootstrap_external>", line 940, in exec_module
> File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
> File "D:\path\padroniza_estilo_planilha.py", line 10, in <module>
>     from botcity.document_processing import *
File   "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\botcity\document_processing\__init__.py",
> line 1, in <module>
>     from .parser import Entry, DocumentParser  # noqa: F401, F403
>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\botcity\document_processing\parser\__init__.py",
> line 1, in <module>
>     from .document import DocumentParser  # noqa: F401, F403
>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\botcity\document_processing\parser\document.py",
> line 4, in <module>`
>     from . import _priv_parser
> 
> ImportError: cannot import name '_priv_parser' from partially initialized module`'botcity.document_processing.parser'
> (most likely due to a circular import)
> (C:\Users\Usuario\AppData\Local\Programs\Python\Python311\Lib\site-packages\botcity\document_processing\parser\__init__.py)

I've tried everything, mostly pip install botcity-documents and pip install --upgrade botcity-documents and it wasn't working well even tho apperently it should, since the "Successfully installed" message was given at the end of the installing.


Solution

  • I am the maintainer of botcity-documents for Python.

    Thank you for reporting this issue. I checked the SHA hashes from the file generated on my build (August 2nd, 2023) and the one available via PyPI, and they match.

    The antivirus solutions are flagging our package because it uses pyminify with gzip, which is commonly used by Machete and could be causing this sort of confusion.

    We changed our strategy, and we are no longer using obfuscation.

    Please switch to the 0.5.0 version.