[Python] How to deploy a Databricks App with tesseract-ocr

Discussão em 'Python' iniciado por Stack, Setembro 4, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to deploy a Databricks app that uses PyMUPDF library to extract text from PDF files. Under the hood, it tries to use an OS dependency called 'tesseract-ocr'. Please note that this is not the pytesseract library, but a dependency that need to be installed on the system.

    My understanding is that when deploying a Databricks App, it takes your source code, requirements.txt, and app.yaml to construct a databricks-specific Docker container after which it exposes your app (e.g. Streamlit). I tried to install the required dependency like so in the app.yaml:

    command:
    - bash
    - -c
    - |
    apt-get update
    apt-get install -y tesseract-ocr
    streamlit run app.py


    However, I get a no access error. Using sudo apt also doesn't work. Is there any other way to install tesseract-ocr within a Databricks App? Please note that installing it on a cluster won't work AFAIK, as a Databricks App runs in isolation.

    I was hoping I could simply provide a Dockerfile that the app deployment process could use, which would resolve this case. This does not seem to be possible. I would find it cumbersome to create a separate API just to make calls for OCR stuff.

    Any suggestions how to resolve this?

    Continue reading...

Compartilhe esta Página