Error importing cv2

I’m trying to deploy an app based on this repository:

I get the following error:

ImportError: libGL.so.1: cannot open shared object file: No such file or directory

Traceback:

File "/usr/local/lib/python3.7/site-packages/streamlit/script_runner.py", line 324, in _run_script
    exec(code, module.__dict__)File "/app/birdspyview/birdspyview.py", line 5, in <module>
    from helpers import calculate_homography, apply_homography_to_image, line_intersect, get_si_from_coordsFile "/app/birdspyview/helpers.py", line 1, in <module>
    import cv2File "/home/appuser/.local/lib/python3.7/site-packages/cv2/__init__.py", line 5, in <module>
    from .cv2 import *

I never got this error while deploying locally. Can anyone help?

Hi @rjtavares! Do you know if opencv-python relies on an OS-level package to be installed?

A quick web search indicates you may need to install some additional packages. Could it be that you have these additional packages installed locally?

In Streamlit sharing platform, we support specifying a list of Debian packages to install via apt-get in a packages.txt file. The file is expected to be at the top level alongside requirements.txt. Could you please give it a shot?

Of course, ffmpeg was missing… Seems to be running now. Thanks!

1 Like