[Streamlit sharing] Importerror: libgl.so.1: cannot open shared object file: no such file or directory opencv error

Hi @djshan1979, thanks for getting back to me :slightly_smiling_face:

I was able to fork your repo and successfully deploy the app on Streamlit Sharing after adding a packages.txt file! Here are the contents of both the files:

packages.txt

freeglut3-dev
libgtk2.0-dev
libgl1-mesa-glx
tesseract-ocr
libtesseract-dev
libtesseract4
tesseract-ocr-all

requirements.txt

streamlit
opencv-python-headless
textblob
scipy
numpy
pytesseract
nltk
pandas
scikit-learn

Your repo seems to be missing packages.txt. Adding the above :point_up: packages.txt file, in addition to replacing opencv-python with opencv-python-headless in requirements.txt worked on my end.

Lastly, for pytesseract to work, you need to install the tesseract binary via packages.txt and replace line 19 of your scorecard_generation.py with:

pytesseract.pytesseract.tesseract_cmd = r'/usr/bin/tesseract'

Let me know if youโ€™re still running into the same error after making these changes :mag:

Happy Streamlit-ing! :balloon:
Snehan

3 Likes