Closed carlosdeoncedos closed 7 months ago
Try TESSDATA_PREFIX=/opt/homebrew/share/tessdata
or even better don't use TESSDATA_PREFIX
(and --tessdata-dir
) at all. Most distributions should not require it. Homebrew works fine without it.
The error message "Error opening data file /opt/homebrew/share/spa.traineddata" is correct: that file or symlink does not exist in a Homebrew installation.
@stweil , I remove TESSDATA_PREFIX
as suggested and it worked perfectly! Thanks for your quick response! Since everything is working now, I will close this issue.
Environment:
Issue
I encountered an issue where Tesseract could not load the Spanish language data (spa.traineddata) despite the file being correctly installed and the TESSDATA_PREFIX environment variable being set to point to the directory containing the tessdata folder (/opt/homebrew/share). This issue persisted even though the spa.traineddata file exists and has appropriate permissions. The error message received was:
I did the following steps to try to solve this issue:
Solution:
As a workaround, specifying the --tessdata-dir option directly in the command (tesseract test_image.png out --tessdata-dir /opt/homebrew/share/tessdata -l spa) successfully bypassed the issue, indicating the problem might be related to how Tesseract resolves the TESSDATA_PREFIX environment variable or handles symbolic links in this context.
To streamline the process, I created an alias in my zshrc profile to include the --tessdata-dir option automatically, allowing me to use Tesseract without manually specifying the path each time.
Questions/Feedback:
Thank you for your support and for developing such a powerful tool.