Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tesseract install mac os

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.
like image 471
Teddy13 Avatar asked Jun 17 '13 05:06

Teddy13


2 Answers

Now, as of September 2019, there are no longer any optional install flags available

brew options tesseract

yield nothing. But,

brew info tesseract

yields the following key info:

This formula contains only the "eng", "osd", and "snum" language data files.
If you need all the other supported languages, `brew install tesseract-lang`.

Therefore, to get all of the languages installed, you need to now install a separate library called tesseract-lang.

Updated installation:

brew install tesseract
brew install tesseract-lang

Hope this helps.

old in case this is useful:

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

like image 53
jamescampbell Avatar answered Sep 22 '22 14:09

jamescampbell


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 successfully

The 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

like image 36
Greta Avatar answered Sep 21 '22 14:09

Greta