Skip to content Skip to sidebar Skip to footer

Tesseractnotfounderror: Two Docker Container Python App (docker-compose)

I have my python project with tesseract running locally, and it works in Pycharm. I used docker-compose.yml, having two containers (app and t4re) as follows: version: '3' services:

Solution 1:

You need to install tesseract in your docker image before using it. By default python:3.6.1 image does not have tesseract in it. You need to take ubuntu base image install tesseract and python in it then continue your work. Here is the docker file for the solution:

FROM ubuntu:18.04
RUN apt-get --fix-missing update && apt-get --fix-broken install && apt-get install -y poppler-utils && apt-get install -y tesseract-ocr && \
    apt-get install -y libtesseract-dev && apt-get install -y libleptonica-dev && ldconfig && apt-get install -y python3.6 && \
    apt-get install -y python3-pip && apt install -y libsm6 libxext6

Please adjust the python version as per your requirement.

Solution 2:

I had this issue on one of my projects that runs on Docker (a Ubuntu container). To solve that, I had to: - install pytesseract via requirements.txt; so it your requirements.txt should contain:

pytesseract  

- you have to install tesseract-ocr. To do that, you have to include the following lines in your dockerfile:

FROM ubuntu:18.04

ENV PYTHONUNBUFFERED 1
RUN apt-getupdate&& apt-get install -y software-properties-common &&add-apt-repository -y ppa:alex-p/tesseract-ocr
RUN apt-getupdate&& apt-get install -y tesseract-ocr-all 
RUN apt-get install -y python3-pip python3-minimal libsm6 libxext6 
# To make sure that tesseract-ocr is installed, uncomment the following line.  
# RUN tesseract --version

Post a Comment for "Tesseractnotfounderror: Two Docker Container Python App (docker-compose)"