PaddlePaddle / PaddleX

All-in-One Development Tool based on PaddlePaddle(飞桨低代码开发工具)
Apache License 2.0
4.85k stars 955 forks source link

安装后初始化报错 #1816

Open shudct opened 3 months ago

shudct commented 3 months ago

Checklist:

  1. 查找历史相关issue寻求解答
  2. 翻阅FAQ常见问题汇总和答疑
  3. 确认bug是否在新版本里还未修复
  4. 翻阅PaddleX 使用文档

描述问题

复现

  1. 您是否已经正常运行我们提供的教程?没有

  2. 您是否在教程的基础上修改代码内容?还请您提供运行的代码

  3. 您使用的数据集是?

  4. 请提供您出现的报错信息及相关log

环境

  1. 请提供您使用的PaddlePaddle和PaddleX的版本号 paddlepaddle-gpu 3.0.0b1 paddlex 3.0.0b0

  2. 请提供您使用的操作系统信息,如Linux/Windows/MacOS linux

  3. 请问您使用的Python版本是? python3.8

  4. 请问您使用的CUDA/cuDNN的版本号是? cuda11.8

按照教程安装paddlex后,跑示例代码,出现错误

Traceback (most recent call last): File "/usr/local/anaconda3/envs/paddleX/bin/paddlex", line 33, in sys.exit(load_entry_point('paddlex', 'console_scripts', 'paddlex')()) File "/usr/local/anaconda3/envs/paddleX/bin/paddlex", line 25, in importlib_load_entry_point return next(matches).load() File "/usr/local/anaconda3/envs/paddleX/lib/python3.8/importlib/metadata.py", line 77, in load module = import_module(match.group('module')) File "/usr/local/anaconda3/envs/paddleX/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 961, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "/home/cc008/projects/PaddleX/paddlex/init.py", line 61, in _initialize() File "/home/cc008/projects/PaddleX/paddlex/init.py", line 38, in _initialize repo_manager.initialize() File "/home/cc008/projects/PaddleX/paddlex/repo_manager/core.py", line 213, in initialize flag = repo.initialize() File "/home/cc008/projects/PaddleX/paddlex/repo_manager/repo.py", line 79, in initialize self.get_pdx() File "/home/cc008/projects/PaddleX/paddlex/repo_manager/repo.py", line 209, in get_pdx return importlib.import_module(self.pdx_mod_name) File "/usr/local/anaconda3/envs/paddleX/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "/home/cc008/projects/PaddleX/paddlex/repo_apis/PaddleDetection_api/init.py", line 16, in from .object_det import DetModel, DetRunner, register File "/home/cc008/projects/PaddleX/paddlex/repo_apis/PaddleDetection_api/object_det/init.py", line 17, in from .model import DetModel File "/home/cc008/projects/PaddleX/paddlex/repo_apis/PaddleDetection_api/object_det/model.py", line 24, in from .config import DetConfig File "/home/cc008/projects/PaddleX/paddlex/repo_apis/PaddleDetection_api/object_det/config.py", line 22, in class DetConfig(BaseConfig, PPDetConfigMixin): File "/home/cc008/projects/PaddleX/paddlex/repo_apis/PaddleDetection_api/object_det/config.py", line 54, in DetConfig data_fields: list[str]=None, TypeError: 'type' object is not subscriptable

示例代码:

import cv2 from paddlex import OCRPipeline from paddlex import PaddleInferenceOption from paddlex.pipelines.OCR.utils import draw_ocr_box_txt

kernel_option = PaddleInferenceOption() kernel_option.set_device("gpu:0")

pipeline = OCRPipeline( 'PP-OCRv4_mobile_det', 'PP-OCRv4_mobile_rec', text_det_kernel_option=kernel_option, text_rec_kernel_option=kernel_option,) result = pipeline.predict( {"input_path": "https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png"}, )

draw_img = draw_ocr_box_txt(result['original_image'],result['dt_polys'], result["rec_text"]) cv2.imwrite("ocr_result.jpg", draw_img[:, :, ::-1])

350050183 commented 3 months ago

安装python 3.9版本

cuicheng01 commented 3 months ago

暂时没有复现您的问题,请问您是完全按照教程走的吗?

350050183 commented 3 months ago

暂时没有复现您的问题,请问您是完全按照教程走的吗?

python3.8不支持数组类型下标,需要python3.9版本,安装手册上说支持3.8-3.12,事实上3.8和3.12均有各种错误,我只测试了3.9正常。而且paddlex --install安装依赖库里,依赖的PyMuPDF限制的版本太低,也执行不成功,需要先升级paddleocr:pip install "paddleocr>=2.0.1" --upgrade PyMuPDF==1.21.1

requirements.txt

tomark~=0.1.4 psutil~=5.9.2 wget grpcio==1.51.3 pydantic~=1.10.1 editdistance openpyxl PyMuPDF==1.20.2 qianfan==0.0.3 langchain==0.0.292 erniebot premailer python-docx unstructured networkx Pillow requests <= 2.29