Home > Software engineering >  PaddleOCR error OSError: [WinError 126] The specified module could not be found
PaddleOCR error OSError: [WinError 126] The specified module could not be found

Time:10-04

I'm currently trying to run a piece of code using PaddleOCR, but I'm stuck at importing PaddleOCR. It gives me the error OSError: [WinError 126] The specified module could not be found.

from paddleocr import PaddleOCR, draw_ocr

Gives Error :

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_16624/4181743072.py in <module>
----> 1 from paddleocr import PaddleOCR, draw_ocr

~\Anaconda3\envs\NUS_PY37\lib\site-packages\paddleocr\__init__.py in <module>
     13 # limitations under the License.
     14 import paddleocr
---> 15 from .paddleocr import *
     16 
     17 __version__ = paddleocr.VERSION

~\Anaconda3\envs\NUS_PY37\lib\site-packages\paddleocr\paddleocr.py in <module>
     24 from pathlib import Path
     25 
---> 26 from tools.infer import predict_system
     27 from ppocr.utils.logging import get_logger
     28 

~\Anaconda3\envs\NUS_PY37\lib\site-packages\paddleocr\tools\infer\predict_system.py in <module>
     29 from PIL import Image
     30 import tools.infer.utility as utility
---> 31 import tools.infer.predict_rec as predict_rec
     32 import tools.infer.predict_det as predict_det
     33 import tools.infer.predict_cls as predict_cls

~\Anaconda3\envs\NUS_PY37\lib\site-packages\paddleocr\tools\infer\predict_rec.py in <module>
     29 
     30 import tools.infer.utility as utility
---> 31 from ppocr.postprocess import build_post_process
     32 from ppocr.utils.logging import get_logger
     33 from ppocr.utils.utility import get_image_file_list, check_and_read_gif

~\Anaconda3\envs\NUS_PY37\lib\site-packages\paddleocr\ppocr\postprocess\__init__.py in <module>
     22 __all__ = ['build_post_process']
     23 
---> 24 from .db_postprocess import DBPostProcess, DistillationDBPostProcess
     25 from .east_postprocess import EASTPostProcess
     26 from .sast_postprocess import SASTPostProcess

~\Anaconda3\envs\NUS_PY37\lib\site-packages\paddleocr\ppocr\postprocess\db_postprocess.py in <module>
     20 import cv2
     21 import paddle
---> 22 from shapely.geometry import Polygon
     23 import pyclipper
     24 

~\Anaconda3\envs\NUS_PY37\lib\site-packages\shapely\geometry\__init__.py in <module>
      2 
      3 
----> 4 from .base import CAP_STYLE, JOIN_STYLE
      5 from .geo import box, shape, asShape, mapping
      6 from .point import Point, asPoint

~\Anaconda3\envs\NUS_PY37\lib\site-packages\shapely\geometry\base.py in <module>
     17 
     18 from shapely.affinity import affine_transform
---> 19 from shapely.coords import CoordinateSequence
     20 from shapely.errors import WKBReadingError, WKTReadingError
     21 from shapely.geos import WKBWriter, WKTWriter

~\Anaconda3\envs\NUS_PY37\lib\site-packages\shapely\coords.py in <module>
      6 from ctypes import byref, c_double, c_uint
      7 
----> 8 from shapely.geos import lgeos
      9 from shapely.topology import Validating
     10 

~\Anaconda3\envs\NUS_PY37\lib\site-packages\shapely\geos.py in <module>
    152     if os.getenv('CONDA_PREFIX', ''):
    153         # conda package.
--> 154         _lgeos = CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll'))
    155     else:
    156         try:

~\Anaconda3\envs\NUS_PY37\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    362 
    363         if handle is None:
--> 364             self._handle = _dlopen(self._name, mode)
    365         else:
    366             self._handle = handle

OSError: [WinError 126] The specified module could not be found

CodePudding user response:

conda install -c conda-forge shapely

resolved by this line of code

  • Related