Please review our installation procedures to find a solution: https://ocrmypdf.readthedocs.io/en/latest/installation.html --------------------------------------------------------------------- """) if os.name == 'nt': # On Windows, recent versions of libpng require zlib. We have to make sure # the zlib version being loaded is the same one that libpng was built with. # This tries to import zlib from Tesseract's installation folder, falling back # to find_library() if liblept is being loaded from somewhere else. # Loading zlib from other places could cause a version mismatch _zlib_path = os.path.join(os.path.dirname(_libpath), 'zlib1.dll') if not os.path.exists(_zlib_path): _zlib_path = find_library('zlib') try: zlib = ffi.dlopen(_zlib_path) except ffi.error as e: raise MissingDependencyError(""" Could not load the zlib library. It could be that Tesseract is not installed properly, we can't find the installation on your system PATH environment variable. """) from e try: lept = ffi.dlopen(_libpath) lept.setMsgSeverity(lept.L_SEVERITY_WARNING) except ffi.error as e: raise MissingDependencyError( f"Leptonica library found at {_libpath}, but we could not access it" ) from e class _LeptonicaErrorTrap_Redirect:
This error normally occurs when ocrmypdf can't find the Leptonica library, which is usually installed with Tesseract OCR. It could be that Tesseract is not installed properly, we can't find the installation on your system PATH environment variable. The library we are looking for is usually called: liblept-5.dll (Windows) liblept*.dylib (macOS) liblept*.so (Linux/BSD) Please review our installation procedures to find a solution: https://ocrmypdf.readthedocs.io/en/latest/installation.html --------------------------------------------------------------------- """) try: lept = ffi.dlopen(_libpath) lept.setMsgSeverity(lept.L_SEVERITY_WARNING) except ffi.error as e: raise MissingDependencyError( f"Leptonica library found at {_libpath}, but we could not access it" ) from e class _LeptonicaErrorTrap_Redirect: """ Context manager to trap errors reported by Leptonica. Leptonica's error return codes don't provide much informatino about what went wrong. Leptonica does, however, write more detailed errors to stderr (provided this is not disabled at compile time). The Leptonica source code is very consistent in its use of macros to generate errors.