Fixing tesseract and Pytesseract Error – TesseractNotFound Error: tesseract is not installed or it’s not in your path

Tesseract and Pytesseract Error – TesseractNotFound Error: tesseract is not installed or it’s not in your path is an error which occurs sometimes because of a faulty tesseract installation or because of other reasons related to Pytesseract.

I will explain why this error takes place and how to fix it, while also trying to add other solutions that could solve the error.

Exploring the tesseract and Pytesseract Error – TesseractNotFound Error: tesseract is not installed or it’s not in your path

This is an error which occurs sometimes because of a faulty tesseract installation or because of other reasons related to Pytesseract.

You should avoid mixing between different errors. The error message should look like the error message bellow.

                                                                       #
TesseractNotFound Error: tesseract is not installed or it's not in your path
                                                                       #

Bellow we will describe how the error can be solved. With multiple possible solutions.

The Method that has worked for me : Correctly install pytesseract and tesseract on Windows, Linux or MacOs

To fix this issue you need to correctly install Pytesseract. This will depend on your platform of course, just follow the instructions bellow.

First, If you are using windows, head to their official GitHub page https://github.com/UB-Mannheim/tesseract/wiki

Then download the tesseract binary.

Now, you need to open your python script and add this to your code

                                                                       #
pytesseract.pytesseract.tesseract_cmd = 'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe'
                                                                       #

Next step is to install tesseract and tesseract-ocr using pip

                                                                       #
pip install tesseract
                                                                       #

Do not forget to install tesseract-ocr

                                                                       #
pip install tesseract-ocr
                                                                       #

If this does not work, consider creating a virtual env and Add the Tesseract path to it.

                                                                       #
C:\Program Files\Tesseract-OCR
                                                                       #

If you are on Linux or MacOs follow this

                                                                       #
sudo apt-get update 
# for linux only
                                                                       #

Then use this command

                                                                       #
sudo apt-get install libleptonica-dev tesseract-ocr tesseract-ocr-dev libtesseract-dev python3-pil tesseract-ocr-eng tesseract-ocr-script-latn
# for linux only
                                                                       #

Only MacOs users have it easy since you only need one command

                                                                       #
brew install tesseract
                                                                       #

I hope this step by step method has solved your issue. Congratulations if this was successful and do not give up i that is not the case, cheers.

Summing-up : 

This is the end of this article, I hope this helped you solve the error : tesseract and Pytesseract Error TesseractNotFound Error tesseract is not installed or it’s not in your path or at least guided you in the right way. You can donate to our Kofi account if you feel generous but you do not Have to.

Thank you for reading, keep coding and cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/