AiStudio安装PaddleOCR报错
收藏
搞不定啊,怎么办?
提示:
ImportError: cannot import name 'LayoutXLMModel' from 'paddlenlp.transformers' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/__init__.py)
Obtaining file:///home/aistudio/PaddleOCR
ERROR: Command errored out with exit status 1:
command: /opt/conda/envs/python35-paddle120-env/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/aistudio/PaddleOCR/setup.py'"'"'; __file__='"'"'/home/aistudio/PaddleOCR/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
cwd: /home/aistudio/PaddleOCR/
Complete output (13 lines):
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/scipy/__init__.py:149: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.16.4
UserWarning)
Traceback (most recent call last):
File "", line 1, in
File "/home/aistudio/PaddleOCR/setup.py", line 17, in
from paddleocr import VERSION
File "/home/aistudio/PaddleOCR/paddleocr.py", line 37, in
from ppstructure.predict_system import OCRSystem, save_structure_res
File "/home/aistudio/PaddleOCR/ppstructure/predict_system.py", line 33, in
from ppstructure.vqa.infer_ser_e2e import SerPredictor, draw_ser_results
File "/home/aistudio/PaddleOCR/ppstructure/vqa/infer_ser_e2e.py", line 24, in
from paddlenlp.transformers import LayoutXLMModel, LayoutXLMTokenizer, LayoutXLMForTokenClassification
ImportError: cannot import name 'LayoutXLMModel' from 'paddlenlp.transformers' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/__init__.py)
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
0
收藏
请登录后评论
哇,太棒了,解决了好多困难呢!!!
但是升级了pip就好了。
请问怎么升级 pip 呢? 运行课件里面的代码。第一句就是升级 pip, 但是还是同样报错,无法导入 LayoutXLM
可以这样解决,不用安装也成!
升级paddlenlp并重启环境即可解决
!pip install paddlenlp==2.2.1
已经解决