QPT-Family / QPT

[内测中]QPT - 致力于让开源项目更好通往互联网世界的Python to EXE工具(Python打包)。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

打包PaddleOCR报错 dep = pkg.requires() TypeError: 'list' object is not callable

leesymbol opened this issue · comments

QPT版本

1.0b7

操作系统版本

Windows 10

核心信息填写

复现步骤/报错截图
大佬好,由于主项目用到了PaddleOCR打包出错,所以根据 【没啥废话版本】使用QPT将PaddleOCR打包为EXE程序新建简易工程进行打包测试,以下是简易工程遇到的错误,与主工程报错相同

步骤描述

(可描述您参考了哪些文档中的步骤,或自己在做哪些操作时遇到了问题,社区维护者可以通过该描述来尽可能复现您的情况)

代码均为测试代码,是否启用requirements_file 都会报出错误
`from qpt.executor import CreateExecutableModule as CEM

module = (
CEM(
work_dir="./", # [项目文件夹]待打包的目录,并且该目录下需要有↓下方提到的py文件
launcher_py_path="ocr.py", # [主程序文件]用户启动EXE文件后,QPT要执行的py文件
save_path="./out",
#requirements_file="requirements.txt",
),
) # [输出目录]打包后相关文件的输出目录

requirements_file="auto" # [Python依赖]此处可填入依赖文件路径,也可设置为auto自动搜索依赖

hidden_terminal=False # [终端窗口]设置为True后,运行时将不会展示黑色终端窗口

interpreter_module=Python37() # [跨版本编译]需要预先from qpt.modules.python_env import Python37

好奇什么时候需要跨版本编译?可参考下方"进阶使用QPT"一节的《打包兼容性更强的Python解释器》

icon="your_ico.ico" # [自定义图标文件]支持将exe文件设置为ico/JPG/PNG等格式的自定义图标

开始打包

module.make()`

【如报错则必须提供】Requirements文件内容

↓建议在此处粘贴完整Requirements(Python第三方依赖)列表信息↓  
anyio==4.3.0
astor==0.8.1
asttokens==2.4.1
attrdict==2.0.1
attrs==23.2.0
Babel==2.14.0
backcall==0.2.0
bce-python-sdk==0.9.6
beautifulsoup4==4.12.3
bleach==6.1.0
blinker==1.7.0
cachetools==5.3.3
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
contourpy==1.2.1
cssselect==1.2.0
cssutils==2.10.2
cycler==0.12.1
Cython==3.0.10
decorator==5.1.1
defusedxml==0.7.1
docopt==0.6.2
et-xmlfile==1.1.0
executing==2.0.1
fastjsonschema==2.19.1
fire==0.6.0
Flask==3.0.3
flask-babel==4.0.0
fonttools==4.51.0
future==1.0.0
h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
idna==3.6
imageio==2.34.0
imgaug==0.4.0
ipython==8.12.3
itsdangerous==2.1.2
jedi==0.19.1
Jinja2==3.1.3
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
jupyter_client==8.6.1
jupyter_core==5.7.2
jupyterlab_pygments==0.3.0
kiwisolver==1.4.5
lazy_loader==0.4
lmdb==1.4.1
lxml==5.2.1
MarkupSafe==2.1.5
matplotlib==3.8.4
matplotlib-inline==0.1.6
mistune==3.0.2
nbclient==0.10.0
nbconvert==7.16.3
nbformat==5.10.4
networkx==3.3
numpy==1.26.4
opencv-contrib-python==4.6.0.66
opencv-python==4.6.0.66
opencv-python-headless==4.9.0.80
openpyxl==3.1.2
opt-einsum==3.3.0
packaging==24.0
paddleocr==2.7.3
paddlepaddle==2.6.1
pandas==2.2.1
pandocfilters==1.5.1
parso==0.8.4
pdf2docx==0.5.8
pefile==2023.2.7
pickleshare==0.7.5
pillow==10.3.0
pip==24.0
pipreqs==0.5.0
platformdirs==4.2.0
premailer==3.10.0
prompt-toolkit==3.0.43
protobuf==3.20.2
psutil==5.9.8
pure-eval==0.2.2
pyclipper==1.3.0.post5
pycryptodome==3.20.0
Pygments==2.17.2
PyMuPDF==1.24.1
PyMuPDFb==1.24.1
pyparsing==3.1.2
python-dateutil==2.9.0.post0
python-docx==1.1.0
pytz==2024.1
pywin32==306
PyYAML==6.0.1
pyzmq==25.1.2
QPT==1.0b7
QPT-SDK==1.0.1
rapidfuzz==3.8.1
rarfile==4.2
referencing==0.34.0
requests==2.31.0
rpds-py==0.18.0
scikit-image==0.22.0
scipy==1.13.0
setuptools==65.5.0
shapely==2.0.3
six==1.16.0
sniffio==1.3.1
soupsieve==2.5
stack-data==0.6.3
termcolor==2.4.0
tifffile==2024.2.12
tinycss2==1.2.1
toml==0.10.2
tornado==6.4
tqdm==4.66.2
traitlets==5.14.2
typing_extensions==4.11.0
tzdata==2024.1
urllib3==2.2.1
visualdl==2.5.3
wcwidth==0.2.13
webencodings==0.5.1
Werkzeug==3.0.2
wget==3.2
yarg==0.1.9
  
↑建议在此处粘贴完整Requirements(Python第三方依赖)列表信息↑  

【如报错则必须提供】完整打包日志

↓建议在此处粘贴完整日志↓  
  →[2024-04-08 18:15:34,088] [DEBUG] | Active code page: 65001
→[2024-04-08 18:15:34,091] [DEBUG] | 终端命令执行成功!
→[2024-04-08 18:15:34,091] [DEBUG] | 正在连接PIPTerminal
→[2024-04-08 18:15:34,127] [DEBUG] | 已设置PIP跨版本编译模式,目标解释器路径为:./out\Release\Python\python.exe
→[2024-04-08 18:15:34,127] [INFO] | 当前解释器版本为Python311,正在向QPT查询是否存在合适的Python镜像...
→[2024-04-08 18:15:34,128] [INFO] | 正在读取E:\Project\Test_Build\requirements.txt下的依赖情况...      
Traceback (most recent call last):
  File "e:\Project\Test_Build\qpt2exe.py", line 4, in <module>
    CEM(
  File "C:\Users\work25\AppData\Local\Programs\Python\Python311\Lib\site-packages\qpt\executor.py", line 182, in __init__
    auto_dependency_module = AutoRequirementsPackage(path=requirements_file,
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\work25\AppData\Local\Programs\Python\Python311\Lib\site-packages\qpt\modules\auto_requirements.py", line 53, in __init__       
    flatten_requirements = QPT_MEMORY.pip_tool.flatten_requirements(dict([(_r, requirements[_r].get("version"))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\work25\AppData\Local\Programs\Python\Python311\Lib\site-packages\qpt\kernel\qinterpreter.py", line 351, in flatten_requirements
    dep_pkg_dict = search_dep()
                   ^^^^^^^^^^^^
  File "C:\Users\work25\AppData\Local\Programs\Python\Python311\Lib\site-packages\qpt\kernel\qpackage.py", line 98, in search_dep
    dep = pkg.requires()
          ^^^^^^^^^^^^^^
TypeError: 'list' object is not callable
↑建议在此处粘贴完整日志↑  

完整运行日志(如打包时已报错,此处可选)

↓建议在此处粘贴完整日志↓  
  
↑建议在此处粘贴完整日志↑  

其他信息

Hi,开发者朋友,鉴于您是首次在QPT下新增Issue,请务必参考给定的Issue模板进行Issue的新增。
虽然形如版本号、打包日志等信息可能对你并不重要,但如未提供则可能会严重拖慢Issue的解决效率,因为他们对于QPT的维护者而言非常重要!
如您未按Issue模板进行内容补充,可关闭此Issue或Edit该Issue,社区维护者会对低效Issue直接Close,请悉知!

`from qpt.executor import CreateExecutableModule as CEM

module = (
CEM(
work_dir="./", # [项目文件夹]待打包的目录,并且该目录下需要有↓下方提到的py文件
launcher_py_path="ocr.py", # [主程序文件]用户启动EXE文件后,QPT要执行的py文件
save_path="./out",
requirements_file="requirements.txt",
),
)
module.make()`

不好意思,注释格式化为标题了,请忽略,核心代码如上,requirements_file是否启用都报错 我打印了下pkg.requires()是存在的,不太熟悉py,麻烦大佬看下

抱歉,这个是已知bug还没修,临时方案辛苦参考这个进行厂商#102

好的 谢谢🙏

我也遇到了这个问题