I am trying to install tesseract on my mac using homeBrew. When I try installing, everything seems to be good but I get the following error/message:
Warning: Could not link leptonica. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link leptonica'
When I try running a tesseract function, I get the following error:
Tesseract Open Source OCR Engine v3.02.02 with Leptonica
Error in pixReadStreamPng: function not present
Error in pixReadStream: png: no pix returned
Error in pixRead: pix not read
Unsupported image type.
I have image magick installed and the command I used to install tesseract was:
brew install tesseract
Can anyone please tell me what I can do to get tesseract working? Thank you!
EDIT When I run brew link leptonica, I get the following error:
Could not symlink file: /usr/local/Cellar/leptonica/1.69/bin/yuvtest
Target /usr/local/bin/yuvtest already exists. You may need to delete it.
After installing / removing and re-installing tesseract i found the solution for the same problem you have. On your terminal logs, while installing tesseract, you will see:
Error: The
brew link
step did not complete successfullyThe formula built, but is not symlinked into /usr/local Could not symlink bin/convertfilestopdf Target /usr/local/bin/convertfilestopdf already exists.
You may want to remove it: rm '/usr/local/bin/convertfilestopdf'
To force the link and overwrite all conflicting files: brew link --overwrite leptonica
To list all files that would be deleted: brew link --overwrite --dry-run leptonica
What i did was running: brew link --overwrite leptonica
"Linking /usr/local/Cellar/leptonica/1.71_1... 45 symlinks created"
Everything should work perfectly.
Hope this can be a help for you
It sounds a bit silly, but have you tried deleting yuvtest? I just tried it myself - the file is automatically generated by brew link leptonica. As for why it isn't working, is it possible you had some version of leptonica/tesseract installed previously? Another reasonable guess at a fix would be
So far as I know, image magick being installed shouldn't matter for tesseract. They don't have anything in common.
Now, as of January 2019, Tesseract installs fine via homebrew, as long as you have xquartz installed first,
brew cask install xquartz
. Then you can do the following:brew install tesseract --with-all-languages --with-serial-num-pack --with-training-tools
Tesseract is now dependent on Leptonica being installed.
The error messages you are seeing relate to these files:
Source: Leptonica unofficial documentation
I found that homebrew would install some but not all of the libraries.