Yolov5 error

ı am getting this error whem ı deploy my yolov5 webapp

  File "/usr/local/lib/python3.7/site-packages/streamlit/script_runner.py", line 333, in _run_script

    exec(code, module.__dict__)

  File "/app/yolov5/app.py", line 4, in <module>

    model = torch.hub.load('ultralytics/yolov5', 'custom', path_or_model='best.pt')

  File "/home/appuser/.local/lib/python3.7/site-packages/torch/hub.py", line 339, in load

    model = _load_local(repo_or_dir, model, *args, **kwargs)

  File "/home/appuser/.local/lib/python3.7/site-packages/torch/hub.py", line 365, in _load_local

    hub_module = import_module(MODULE_HUBCONF, hubconf_path)

  File "/home/appuser/.local/lib/python3.7/site-packages/torch/hub.py", line 74, in import_module


  File "<frozen importlib._bootstrap_external>", line 728, in exec_module

  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

  File "/home/appuser/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 12, in <module>

    from models.yolo import Model

  File "/home/appuser/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py", line 9, in <module>

    from models.common import *

  File "/home/appuser/.cache/torch/hub/ultralytics_yolov5_master/models/common.py", line 12, in <module>

    from utils.datasets import letterbox

  File "/home/appuser/.cache/torch/hub/ultralytics_yolov5_master/utils/datasets.py", line 15, in <module>

    import cv2

  File "/home/appuser/.local/lib/python3.7/site-packages/cv2/__init__.py", line 5, in <module>

    from .cv2 import *

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

[client] Connecting...
 our support engineers for answers to questions.

Hello @isaacnewton35 !

Are you deploying on Streamlit Sharing? If that’s the case, it seems from this answer that you are missing the package libgl1-mesa-dev.

Can you try adding a packages.txt file with libgl1-mesa-dev inside to the root of your project, which should force the reinstall of the package :slight_smile: ? (You can find and example here)

If on another Cloud provider, you should consult their doc to see how to install a Unix package and reistall it that way.

Hope it helps!

Have a nice day,