Tesseract / Installation errors

Causes and fixes for Tesseract installation errors

Common errors when installing Tesseract, pytesseract and language data, listed by exact message, each with its cause and fix.

Short answer

Tesseract is a separate OCR program, and pip install pytesseract only installs the Python wrapper that calls it, so the program itself and language data such as Chinese must be installed separately, and missing either one causes an error.

Setting up your environment this way avoids most errors on this page.

PracticeWhat happens if you skip it
Install the Tesseract program first (the UB Mannheim installer on Windows, apt install tesseract-ocr on Ubuntu, brew install tesseract on macOS), then pip install pytesseract.Python calls fail with TesseractNotFoundError.
Install the language data you need at the same time: chi_sim for Simplified Chinese, chi_tra for Traditional.Chinese recognition fails with Failed loading language 'chi_sim'.
On Windows, add the Tesseract install folder to PATH or set pytesseract.pytesseract.tesseract_cmd in code.Tesseract works on the command line but Python cannot find it.
When downloading language data yourself, pick one of tessdata, tessdata_best or tessdata_fast and put it in the tessdata folder Tesseract actually reads.Files in the wrong folder, or incompatible with the --oem option, cause recognition errors.
When deploying to the cloud, list tesseract-ocr and the language packages in the platform's system package file.Everything works locally but fails with TesseractNotFoundError after deployment.

Troubleshooting by error message

Find your exact error message. Each entry gives the cause, the fix, and what may come up after the fix.

pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.

Cause: Only pytesseract is installed, not the Tesseract program, or the Tesseract folder is not on PATH.

Fix: Install the Tesseract program; on Windows, add pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe" at the top of your code, using your install path.

What may come next: Inside WSL, a Tesseract installed on Windows cannot be used; install it again in WSL with apt.

Error opening data file /usr/share/tesseract/4/tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory.

Cause: The Tesseract program is installed, but the language data file (here English, eng.traineddata) is not.

Fix: Run sudo apt install tesseract-ocr-eng on Ubuntu or Debian, or sudo yum install tesseract-langpack-eng on RHEL or CentOS.

Failed loading language 'chi_sim' Tesseract couldn't load any languages! Could not initialize tesseract.

Cause: The Simplified Chinese language data chi_sim.traineddata is not installed.

Fix: On Ubuntu run sudo apt install tesseract-ocr-chi-sim; on Windows rerun the installer and tick Chinese (Simplified) under Additional language data, or put chi_sim.traineddata into the Tesseract tessdata folder.

What may come next: Language data from tessdata_best or tessdata_fast only supports --oem 1, so --oem 0 or 2 still fails.

Error opening data file (on Windows, although the language file is in the tessdata folder)

Cause: TESSDATA_PREFIX points to another folder, or the --tessdata-dir path contains spaces without quotes.

Fix: Set TESSDATA_PREFIX to the tessdata folder that holds the language files; in pytesseract pass config=r'--tessdata-dir "C:\Program Files\Tesseract-OCR\tessdata"', keeping the double quotes.

pytesseract.pytesseract.TesseractNotFoundError (after deploying to Streamlit Community Cloud)

Cause: The platform has no Tesseract program installed. Streamlit Community Cloud only reads packages.txt in the repo root to install system software.

Fix: List tesseract-ocr and the language packages you need (for example tesseract-ocr-chi-sim) in packages.txt at the repo root and redeploy.

What may come next: A local path hard-coded in your code (for example C:\Program Files\Tesseract-OCR) does not exist on the server; remove it or use shutil.which("tesseract").

Scientify is a cloud computer with research software installed and AI agents such as Codex and Claude Code built in. Describe what you need in one sentence, for example "recognize the Chinese text in these scanned archive pages and export it as searchable text", and the agent uses the preinstalled Tesseract to do the text recognition, with no software to install and no code to write.

Compared with installing more on your own computer, the cloud computer already has Tesseract 5.5.3 with Simplified and Traditional Chinese language data, so there is no installer to find, PATH to set or language data to download, and runs continue after you close your laptop.

The cloud computer comes with more computing power: CPU and GPU clusters can be called on demand for large-scale scientific computing. Compute is billed by the minutes you actually use, so nothing is wasted.

Cloud computer
4 vCPU · 8 GB
Top configuration, for data processing and small to medium jobs
Callable GPU
96 GB VRAM
Up to an RTX PRO 6000 per GPU; H800 80 GB and up to 8 × A10G also available
Callable CPU
224 cores · 3 TB
Largest spec, for large parallel computations

References

Frequently asked questions

Why install Tesseract after pip install pytesseract?

pytesseract is only a Python wrapper around the tesseract command; the recognition is done by the Tesseract program, so both must be installed.

How do I see which languages are installed?

Run tesseract --list-langs; chi_sim must be listed to recognize Simplified Chinese.

tessdata, tessdata_best or tessdata_fast?

Linux distributions ship tessdata_fast, the fastest; tessdata_best is the most accurate but slowest and only supports --oem 1. The distribution package is usually fine.

Run OCR with Scientify without setup

Upload your data, describe the computation, and Scientify runs it on a cloud computer that is already set up. New accounts get a free cloud computer and US$5 in credit.