tesserocr icon indicating copy to clipboard operation
tesserocr copied to clipboard

ImportError: dlopen

Open mhluska opened this issue 1 year ago • 4 comments

Seeing the following issue on a MacBook M2 Max:

ImportError: dlopen(/Users/mhluska/project/env/lib/python3.11/site-packages/tesserocr.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '__ZN9tesseract11TessBaseAPID1Ev'

Python version 3.11.4

Using venv with tesserocr 2.6.0

Tesseract version 5.3.2

mhluska avatar Aug 05 '23 03:08 mhluska

You are using tesserocr build against different version of tesseract.

zdenop avatar Aug 05 '23 08:08 zdenop

How would I fix the issue? I've tried reinstalling both tesseract and tesserocr. Do I need a specific version of tesseract with this version of tesserocr?

mhluska avatar Aug 05 '23 16:08 mhluska

I managed to get it working by installing older versions:

Install tesseract 5.3.1-1 specifically (last known working version):

curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/8bedbf36570ebcbae090227aed6048f7e08f1c76/Formula/tesseract.rb
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install tesseract.rb
rm tesseract.rb

Install tesserocr v2.6.0:

pip uninstall tesserocr
pip install --no-cache-dir tesserocr==2.6.0

It would be nice to know how to avoid having to do this though.

mhluska avatar Aug 05 '23 17:08 mhluska

Try to install tesserocr from source instead of pip... (not sure about Mac/brew, but e.g. on Linux you will need the Tesseract and Leptonica dev packages)

zdenop avatar Aug 05 '23 19:08 zdenop