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

Issue importing the packages from of PaddleOCR, draw_ocr #10443

Closed
AGRocky opened this issue Jul 20, 2023 · 26 comments
Closed

Issue importing the packages from of PaddleOCR, draw_ocr #10443

AGRocky opened this issue Jul 20, 2023 · 26 comments
Assignees
Labels

Comments

@AGRocky
Copy link

AGRocky commented Jul 20, 2023

Hi folks, Great day to Y'all. Please try helping me out with this.
I'd try running paddleocr in google colab but getting issue importing the packages from of PaddleOCR, draw_ocr. Below is the error message.
Error: Can not import paddle core while this file exists: /usr/local/lib/python3.10/dist-packages/paddle/fluid/libpaddle.so
ImportError: libssl.so.1.1: cannot open shared object file: No such file or directory

@joel1895
Copy link

I am also facing the same issue. It was working fine till yesterday, since today I am facing this error.

@ToddBear ToddBear added the good first issue Good for newcomers label Jul 20, 2023
@AGRocky
Copy link
Author

AGRocky commented Jul 20, 2023

Exactly pls let me know if you find out anything.
Thank you

@joel1895
Copy link

I installed paddleocr gpu and it's working and much faster.

!pip install paddleocr
!python -m pip install paddlepaddle-gpu==2.5.0.post118 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

@AGRocky
Copy link
Author

AGRocky commented Jul 20, 2023

Thank you so much @joel1895 it helped me. But the extraction is lil different with this dependencies

@joel1895
Copy link

Worked for me

@GreatV
Copy link
Collaborator

GreatV commented Jul 21, 2023

Hi @AGRocky, You may try downgrading the paddle version to 2.4.2.

@AGRocky
Copy link
Author

AGRocky commented Jul 21, 2023

Hi @GreatV still it doesn't work!

@GreatV
Copy link
Collaborator

GreatV commented Jul 21, 2023

@ChetnaLongani
Copy link

I had same error, its solved for me. Thank you so much.

@vicenteguedes
Copy link

Hi @AGRocky, You may try downgrading the paddle version to 2.4.2.

Downgrading to 2.4.2 worked for me. Thank you!

@promaprogga
Copy link

[Errno 2] No such file or directory: 'PaddleOCR/ppstructure'
/content/PaddleOCR/ppstructure/inference
Error: Can not import paddle core while this file exists: /usr/local/lib/python3.10/dist-packages/paddle/fluid/libpaddle.so
Traceback (most recent call last):
File "/content/PaddleOCR/ppstructure/table/predict_table.py", line 29, in
import tools.infer.predict_rec as predict_rec
File "/content/PaddleOCR/tools/infer/predict_rec.py", line 28, in
import paddle
File "/usr/local/lib/python3.10/dist-packages/paddle/init.py", line 31, in
from .framework import monkey_patch_variable
File "/usr/local/lib/python3.10/dist-packages/paddle/framework/init.py", line 17, in
from . import random # noqa: F401
File "/usr/local/lib/python3.10/dist-packages/paddle/framework/random.py", line 17, in
from paddle import fluid
File "/usr/local/lib/python3.10/dist-packages/paddle/fluid/init.py", line 36, in
from . import framework
File "/usr/local/lib/python3.10/dist-packages/paddle/fluid/framework.py", line 35, in
from . import core
File "/usr/local/lib/python3.10/dist-packages/paddle/fluid/core.py", line 356, in
raise e
File "/usr/local/lib/python3.10/dist-packages/paddle/fluid/core.py", line 269, in
from . import libpaddle
ImportError: libssl.so.1.1: cannot open shared object file: No such file

i amgetting this error, let me give the line number codes
File "/content/PaddleOCR/tools/infer/predict_rec.py", line 28, in
import tools.infer.predict_rec as predict_rec
import tools.infer.predict_det as predict_det
import tools.infer.utility as utility
from tools.infer.predict_system import sorted_boxes
from ppocr.utils.utility import get_image_file_list, check_and_read
from ppocr.utils.logging import get_logger
from ppstructure.table.matcher import TableMatch
from ppstructure.table.table_master_match import TableMasterMatcher
from ppstructure.utility import parse_args
import ppstructure.table.predict_structure as predict_strture
cant import those
File "/content/PaddleOCR/tools/infer/predict_rec.py", line 28, in
import paddle
import tools.infer.utility as utility
from ppocr.postprocess import build_post_process
from ppocr.utils.logging import get_logger
from ppocr.utils.utility import get_image_file_list, check_and_read
like these. please help me to solve, i am trying in colab

@GreatV
Copy link
Collaborator

GreatV commented Sep 24, 2023

@promaprogga
Copy link

promaprogga commented Sep 25, 2023

didnt solve

@GreatV
Copy link
Collaborator

GreatV commented Sep 25, 2023

hi @promaprogga, You could try installing libssl on colab. Since your colab environment is UBUNTU.

@promaprogga
Copy link

Connecting to archive.ubuntu.com (archive.ubuntu.com)|91.189.91.83|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2023-09-25 05:47:57 ERROR 404: Not Found.

dpkg: error: cannot access archive 'libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb': No such file or directory

@promaprogga
Copy link

promaprogga commented Sep 25, 2023

Still getting same error, let me give you the whole code
!git clone https://github.com/PaddlePaddle/PaddleOCR.git
!pip install paddleocr --upgrade
!pip install paddlepaddle
%cd PaddleOCR/ppstructure

!mkdir inference
%cd inference

!wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_det_infer.tar && tar xf en_ppocr_mobile_v2.0_table_det_infer.tar

!wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_rec_infer.tar && tar xf en_ppocr_mobile_v2.0_table_rec_infer.tar
!wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_structure_infer.tar && tar xf en_ppocr_mobile_v2.0_table_structure_infer.tar

!sudo apt-get install libssl1.1

!source /path/to/your/virtualenv/bin/activate
!pip install paddleocr

%cd PaddleOCR/ppstructure
!python /content/PaddleOCR/ppstructure/table/predict_table.py --det_model_dir=inference/en_PP-OCRv3_det_infer --rec_model_dir=inference/en_ppocr_mobile_v2.0_table_rec_infer --table_model_dir=inference/en_ppocr_mobile_v2.0_table_structure_infer --image_dir=/content/drive/MyDrive/SSCL/Code/Table/image --rec_char_dict_path=../ppocr/utils/dict/table_dict.txt --table_char_dict_path=../ppocr/utils/dict/table_structure_dict.txt --det_limit_side_len=736 --det_limit_type=min --output ./content/drive/MyDrive/SSCL/Code/Table/output_paddle

@GreatV
Copy link
Collaborator

GreatV commented Sep 25, 2023

hi @promaprogga, This issue has been fixed in the paddle develop branch.

You may now install the develop version to avoid this problem.

python -m pip install paddlepaddle==0.0.0 -f https://www.paddlepaddle.org.cn/whl/linux/cpu-mkl/develop.html

@promaprogga
Copy link

Still error @GreatV
[Errno 2] No such file or directory: 'PaddleOCR/ppstructure'
/content/PaddleOCR/ppstructure/inference/PaddleOCR/ppstructure
Traceback (most recent call last):
File "/content/PaddleOCR/ppstructure/table/predict_table.py", line 230, in
main(args)
File "/content/PaddleOCR/ppstructure/table/predict_table.py", line 153, in main
table_sys = TableSystem(args)
File "/content/PaddleOCR/ppstructure/table/predict_table.py", line 67, in init
self.text_detector = predict_det.TextDetector(copy.deepcopy(
File "/content/PaddleOCR/tools/infer/predict_det.py", line 141, in init
self.predictor, self.input_tensor, self.output_tensors, self.config = utility.create_predictor(
File "/content/PaddleOCR/tools/infer/utility.py", line 199, in create_predictor
raise ValueError(
ValueError: not find model.pdmodel or inference.pdmodel in inference/en_PP-OCRv3_det_infer

@GreatV
Copy link
Collaborator

GreatV commented Sep 25, 2023

@promaprogga, This is another error, please check if the model file is placed correctly.

@promaprogga
Copy link

Everything is in correct place

@GreatV
Copy link
Collaborator

GreatV commented Sep 25, 2023

image

Your cd command was not executed correctly.

@promaprogga
Copy link

run

%cd /content/PaddleOCR/ppstructure
!python /content/PaddleOCR/ppstructure/table/predict_table.py --det_model_dir=inference/en_ppocr_mobile_v2.0_table_det_infer --rec_model_dir=inference/en_ppocr_mobile_v2.0_table_rec_infer --table_model_dir=inference/en_ppocr_mobile_v2.0_table_structure_infer --image_dir=/content/drive/MyDrive/SSCL/Code/Table/image --rec_char_dict_path=../ppocr/utils/dict/table_dict.txt --table_char_dict_path=../ppocr/utils/dict/table_structure_dict.txt --det_limit_side_len=736 --det_limit_type=min --output=/content/drive/MyDrive/SSCL/Code/Table/output_paddle
it works but in csv there is no text

@risemeup1
Copy link

PaddlePaddle/Paddle#57147 This PR will sovle this problem,it will be megred tommorrow

@risemeup1
Copy link

@maifeeulasad
Copy link

You don't face this issue on Ubuntu < 22.04 LTS

And on Ubuntu 22.04 LTS, there is a solution:

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb

ref: https://stackoverflow.com/a/73603200/10305444

@GreatV
Copy link
Collaborator

GreatV commented Mar 18, 2024

@jzhang533 This issue has been answered clearly and we can close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests