Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tesseract installed via home-brew, Anaconda says no module 'pytesseract?

Sorry, complete newbie question here.....I installed tesseract, tesseract-lang both via homebrew, also via the terminal (using conda install https://anaconda.org/conda-forge/tesseract ). In the terminal it looks like it is installed as I get this message when I try to reinstall it;

 ~ % conda install -c conda-forge tesseract
Collecting package metadata (current_repodata.json): done
Solving environment: done

All requested packages already installed.

However, when I run this code;

from PIL import Image
import pytesseract 
import numpy as np

filename = 'example_image_01.png'
img1 = np.array(Image.open(filename))
text = pytesseract.image_to_string(img1)

print(text)

Anaconda returns;
ModuleNotFoundError: No module named 'pytesseract'

I have also tried it with just tesseract but to no avail.

Anyone have any suggestions given I am relatively inexperienced as I am still learning python.

Thanks, Trevor

like image 905
T-RevLey Avatar asked Dec 14 '25 21:12

T-RevLey


1 Answers

The packages tesseract and pytesseract are distinct. The latter is what provides Python bindings for interacting with the former. That is, you need to install both packages to use the latter:

conda install -c conda-forge pytesseract tesseract

Technically, if one already has tesseract installed on the system-level, then it should not need to be separately installed in the Conda environment. However, some may regard it as better practice to include everything needed to replicate a project in the Conda environment.

like image 167
merv Avatar answered Dec 16 '25 13:12

merv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!