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

remove un-used imported modules, so to avoid PyInstaller packaged binary runtime error #10502

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

kerneltravel
Copy link
Contributor

@kerneltravel kerneltravel commented Jul 30, 2023

by current PR, remove un-used imported modules in code, so to avoid PyInstaller packaged binary 's py-script import them, which in fact is not included by pyinstaller when package.

if not merge current PR , then PyInstaller should add parameter --hidden-import imghdr --hidden-import scipy.io and must add parameter --collect-all paddleocr , but the previous parameter is not suggested to hidden-import un-used modules for package release.

Previously there is a commit has Improve package import compatibility of paddleocr.py file. but the pyinstaller packaged execution file runtime not found module issue still exists.

I had tried another PR #10421 ,but that is not the root cause.

history:

  1. the related issues ID No module named 'tools.infer'  #1024 使用Pyinstaller将PPOCRLabel.py打包成exe文件时遇到No module named 'framework_pb2'的报错。官方是不是有一个打包工具的,这个工具文档在哪里? #9355 ModuleNotFoundError: No module named 'tools' #10398, Pyinstaller - no module named "ppocr" #10340, Pyinstaller exe problem #9951, hubserving运行。服务调用。多调用几次会报找不到tools包。整个hubserving当掉 #9723 ModuleNotFoundError: No module named 'tools' #9694, Pyinstall related problem #9944, 给各位老总一个建议,关于大家用pyinstaller打包exe会出现各种ModuleNotFoundError: No module named 'XXXX' #9408 , 使用pyinstaller打包成可执行文件报错 #7635, 用Pyinstaller构建可执行程序 No module name 'tools' #4390
  2. how to reproduce the above issue: https://github.com/kerneltravel/PaddleOCR_PR10421_reproduce/blob/1ed3c8211ca07f9779c10e07dfbfcf81466ddfd5/README.md

NOTE: those people who want to use pyinstaller to package python-application with paddleocr may referer to this to append parameter --collect-all paddleocr to pyinstaller . --collect-all MODULE_NAMES means Collect all submodules, data files, and binaries from the specified package or module.

@paddle-bot
Copy link

paddle-bot bot commented Jul 30, 2023

Thanks for your contribution!

Copy link
Collaborator

@shiyutang shiyutang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shiyutang shiyutang merged commit 2b7b9dc into PaddlePaddle:release/2.6 Aug 2, 2023
@shiyutang
Copy link
Collaborator

Thank you very much for your contribution, please cherry-pick this commit to the dygraph branch as well. :)

@kerneltravel
Copy link
Contributor Author

@shiyutang 要求怎样做?

Thank you very much for your contribution, please cherry-pick this commit to the dygraph branch as well. :)

shiyutang pushed a commit that referenced this pull request Oct 16, 2023
shiyutang added a commit that referenced this pull request Oct 18, 2023
* Update recognition_en.md (#10059)

ic15_dict.txt only have 36 digits

* Update ocr_rec.h (#9469)

It is enough to include preprocess_op.h, we do not need to include ocr_cls.h.

* 补充num_classes注释说明 (#10073)

ser_vi_layoutxlm_xfund_zh.yml中的Architecture.Backbone.num_classes所赋值会设置给Loss.num_classes,
由于采用BIO标注,假设字典中包含n个字段(包含other)时,则类别数为2n-1;假设字典中包含n个字段(不含other)时,则类别数为2n+1。

* Update algorithm_overview_en.md (#9747)

Fix links to super-resolution algorithm docs

* 改进文档`deploy/hubserving/readme.md`和`doc/doc_ch/models_list.md` (#9110)

* Update readme.md

* Update readme.md

* Update readme.md

* Update models_list.md

* trim trailling spaces @ `deploy/hubserving/readme_en.md`

* `s/shell/bash/` @ `deploy/hubserving/readme_en.md`

* Update `deploy/hubserving/readme_en.md` to sync with `deploy/hubserving/readme.md`

* Update deploy/hubserving/readme_en.md to sync with `deploy/hubserving/readme.md`

* Update deploy/hubserving/readme_en.md to sync with `deploy/hubserving/readme.md`

* Update `doc/doc_en/models_list_en.md` to sync with `doc/doc_ch/models_list_en.md`

* using Grammarly to weak `deploy/hubserving/readme_en.md`

* using Grammarly to tweak `doc/doc_en/models_list_en.md`

* `ocr_system` module will return with values of field `confidence`

* Update README_CN.md

* 修复测试服务中图片转Base64的引用地址错误。 (#8334)

* Update application.md

* [Doc] Fix 404 link.  (#10318)

* Update PP-OCRv3_det_train.md

* Update knowledge_distillation.md

* Update config.md

* Fix fitz camelCase deprecation and .PDF not being recognized as pdf file (#10181)

* Fix fitz camelCase deprecation and .PDF not being recognized as pdf file

* refactor get_image_file_list function

* Update customize.md (#10325)

* Update FAQ.md (#10345)

* Update FAQ.md (#10349)

* Don't break overall processing on a bad image (#10216)

* Add preprocessing common to OCR tasks (#10217)

Add preprocessing to options

* [MLU] add mlu device for infer (#10249)

* Create newfeature.md

* Update newfeature.md

* remove unused imported module, so can avoid PyInstaller packaged binary's start-time not found module error. (#10502)

* CV套件建设专项活动 - 文字识别返回单字识别坐标 (#10515)

* modification of return word box

* update_implements

* Update rec_postprocess.py

* Update utility.py

* Update README_ch.md

* revert README_ch.md update

* Fixed Layout recovery README file (#10493)

Co-authored-by: Shubham Chambhare <shubhamchambhare@zoop.one>

* update_doc

* bugfix

---------

Co-authored-by: ChuongLoc <89434232+ChuongLoc@users.noreply.github.com>
Co-authored-by: Wang Xin <xinwang614@gmail.com>
Co-authored-by: tanjh <dtdhinjapan@gmail.com>
Co-authored-by: Louis Maddox <lmmx@users.noreply.github.com>
Co-authored-by: n0099 <n@n0099.net>
Co-authored-by: zhenliang li <37922155+shouyong@users.noreply.github.com>
Co-authored-by: itasli <ilyas.tasli@outlook.fr>
Co-authored-by: UserUnknownFactor <63057995+UserUnknownFactor@users.noreply.github.com>
Co-authored-by: PeiyuLau <135964669+PeiyuLau@users.noreply.github.com>
Co-authored-by: kerneltravel <kjpioo2006@gmail.com>
Co-authored-by: ToddBear <43341135+ToddBear@users.noreply.github.com>
Co-authored-by: Ligoml <39876205+Ligoml@users.noreply.github.com>
Co-authored-by: Shubham Chambhare <59397280+Shubham654@users.noreply.github.com>
Co-authored-by: Shubham Chambhare <shubhamchambhare@zoop.one>
Co-authored-by: andyj <87074272+andyjpaddle@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants