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

报错 #746

Open
liepinlxy opened this issue Oct 16, 2024 · 4 comments
Open

报错 #746

liepinlxy opened this issue Oct 16, 2024 · 4 comments

Comments

@liepinlxy
Copy link

请问这个报错该如何解决,昨天正常使用,今天突然开始报这个错误
2024-10-16 11:13:45.180 | INFO | magic_pdf.libs.pdf_check:detect_invalid_chars:57 - cid_count: 0, text_len: 1872, cid_chars_radio: 0.0
2024-10-16 11:13:45.182 | ERROR | magic_pdf.tools.cli:parse_doc:96 - partially initialized module 'paddle' has no attribute 'tensor' (most likely due to a circular import)
Traceback (most recent call last):

File "/usr/local/bin/magic-pdf", line 8, in
sys.exit(cli())
│ │ └
│ └
└ <module 'sys' (built-in)>
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
│ │ │ └ {}
│ │ └ ()
│ └ <function BaseCommand.main at 0x7ff3c2239000>

File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
│ │ └ <click.core.Context object at 0x7ff3c267bc10>
│ └ <function Command.invoke at 0x7ff3c2239ab0>

File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
│ │ │ │ │ └ {'path': 'pdf/complex_structure/', 'output_dir': 'result/', 'method': 'auto', 'debug_able': False, 'start_page_id': 0, 'end_p...
│ │ │ │ └ <click.core.Context object at 0x7ff3c267bc10>
│ │ │ └ <function cli at 0x7ff267ccb010>
│ │ └
│ └ <function Context.invoke at 0x7ff3c2238820>
└ <click.core.Context object at 0x7ff3c267bc10>
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
│ └ {'path': 'pdf/complex_structure/', 'output_dir': 'result/', 'method': 'auto', 'debug_able': False, 'start_page_id': 0, 'end_p...
└ ()
File "/usr/local/lib/python3.10/site-packages/magic_pdf/tools/cli.py", line 100, in cli
parse_doc(doc_path)
│ └ PosixPath('pdf/complex_structure/【Procurement_Manager_广州】马赛尔_10年以上.pdf')
└ <function cli..parse_doc at 0x7ff3c2479bd0>

File "/usr/local/lib/python3.10/site-packages/magic_pdf/tools/cli.py", line 84, in parse_doc
do_parse(
└ <function do_parse at 0x7ff267cca3b0>
File "/usr/local/lib/python3.10/site-packages/magic_pdf/tools/common.py", line 79, in do_parse
pipe.pipe_analyze()
│ └ <function UNIPipe.pipe_analyze at 0x7ff267cca950>
└ <magic_pdf.pipe.UNIPipe.UNIPipe object at 0x7ff0f853e2c0>
File "/usr/local/lib/python3.10/site-packages/magic_pdf/pipe/UNIPipe.py", line 30, in pipe_analyze
self.model_list = doc_analyze(self.pdf_bytes, ocr=False,
│ │ │ │ └ b'%PDF-1.7\n%\xe2\xe3\xcf\xd3\n3 0 obj\n<</Type/Font/Subtype/Type1/BaseFont/Helvetica/Encoding/WinAnsiEncoding>>\nendobj\n1 0...
│ │ │ └ <magic_pdf.pipe.UNIPipe.UNIPipe object at 0x7ff0f853e2c0>
│ │ └ <function doc_analyze at 0x7ff31cb48790>
│ └ []
└ <magic_pdf.pipe.UNIPipe.UNIPipe object at 0x7ff0f853e2c0>
File "/usr/local/lib/python3.10/site-packages/magic_pdf/model/doc_analyze_by_custom_model.py", line 110, in doc_analyze
custom_model = model_manager.get_model(ocr, show_log)
│ │ │ └ False
│ │ └ False
│ └ <function ModelSingleton.get_model at 0x7ff31cb48700>
└ <magic_pdf.model.doc_analyze_by_custom_model.ModelSingleton object at 0x7ff267cdc5b0>
File "/usr/local/lib/python3.10/site-packages/magic_pdf/model/doc_analyze_by_custom_model.py", line 63, in get_model
self._models[key] = custom_model_init(ocr=ocr, show_log=show_log)
│ │ │ │ │ └ False
│ │ │ │ └ False
│ │ │ └ <function custom_model_init at 0x7ff31cb485e0>
│ │ └ (False, False)
│ └ {}
└ <magic_pdf.model.doc_analyze_by_custom_model.ModelSingleton object at 0x7ff267cdc5b0>
File "/usr/local/lib/python3.10/site-packages/magic_pdf/model/doc_analyze_by_custom_model.py", line 83, in custom_model_init
from magic_pdf.model.pdf_extract_kit import CustomPEKModel
File "/usr/local/lib/python3.10/site-packages/magic_pdf/model/pdf_extract_kit.py", line 36, in
from magic_pdf.model.pek_sub_modules.self_modify import ModifiedPaddleOCR
File "/usr/local/lib/python3.10/site-packages/magic_pdf/model/pek_sub_modules/self_modify.py", line 9, in
from paddleocr import PaddleOCR
File "/usr/local/lib/python3.10/site-packages/paddleocr/init.py", line 14, in
from .paddleocr import *
File "/usr/local/lib/python3.10/site-packages/paddleocr/paddleocr.py", line 21, in
import paddle
File "/usr/local/lib/python3.10/site-packages/paddle/init.py", line 38, in
monkey_patch_variable()
└ <function monkey_patch_variable at 0x7ff105539e10>
File "/usr/local/lib/python3.10/site-packages/paddle/base/layers/math_op_patch.py", line 756, in monkey_patch_variable
for method_name in paddle.tensor.tensor_method_func:
└ <module 'paddle' from '/usr/local/lib/python3.10/site-packages/paddle/init.py'>

AttributeError: partially initialized module 'paddle' has no attribute 'tensor' (most likely due to a circular import)

@myhloli
Copy link
Collaborator

myhloli commented Oct 16, 2024

环境在这两天有做什么变动吗?

@liepinlxy
Copy link
Author

没有,昨天只在新的虚拟环境中安装了magic-doc

@myhloli
Copy link
Collaborator

myhloli commented Oct 16, 2024

那确实挺怪的,尤其是在之前能正常运行的环境突然出问题。。可以试试重新建个新的conda环境再装一遍

@myhloli myhloli closed this as completed Oct 16, 2024
@myhloli myhloli reopened this Oct 16, 2024
@liepinlxy
Copy link
Author

已经做过了,不好使。。。
image

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

2 participants