Describe the bug
Deploy step errors out due to missing libGL.so.1 when importing the library cv2. I would expect that this is part of the image itself- does it mean I need to use a custom image to install libGL?
To reproduce
Add an import cv2 statement to the inference.py script bundled with your model.
requirements.txt is located in the same directory as inference.py with the following contents:
opencv-contrib-python>=4.3.0.36
numpy>=1.19.0
Expected behavior
This inference script is supposed to load an image from a URL given in the payload, and format the contents for inference.
Screenshots or logs
Relevant CloudWatch logs:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/ggevent.py", line 203, in init_process
super(GeventWorker, self).init_process()
File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.6/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.6/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.6/dist-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/sagemaker/python_service.py", line 440, in <module>
resources = ServiceResources()
File "/sagemaker/python_service.py", line 426, in __init__
self._python_service_resource = PythonServiceResource()
File "/sagemaker/python_service.py", line 74, in __init__
self._handler, self._input_handler, self._output_handler = self._import_handlers()
File "/sagemaker/python_service.py", line 303, in _import_handlers
spec.loader.exec_module(inference)
File "/opt/ml/model/code/inference.py", line 6, in <module>
import cv2
File "/usr/local/lib/python3.6/dist-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
System information
A description of your system. Please provide:
Describe the bug Deploy step errors out due to missing libGL.so.1 when importing the library
cv2
. I would expect that this is part of the image itself- does it mean I need to use a custom image to install libGL?To reproduce Add an
import cv2
statement to theinference.py
script bundled with your model.requirements.txt
is located in the same directory asinference.py
with the following contents:Expected behavior This inference script is supposed to load an image from a URL given in the payload, and format the contents for inference.
Screenshots or logs Relevant CloudWatch logs:
System information A description of your system. Please provide: