Having issue with setting up Python opencv library in Docker container which is using Ubuntu 24.04
My project is using Python version 3.10. with opencv-headless
, but one of the dependencies that I'm using is using opencv-python
Error that I'm getting
File "/usr/local/lib/python3.10/site-packages/cv2/__init__.py", line 153, in bootstrap native_module = importlib.import_module("cv2") File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)ImportError: libGL.so.1: cannot open shared object file: No such file or directory
There was a similar question on SO and suggestion was to install libgl1-mesa-glx
but seems like on Ubuntu 24.04 this package is deprecated. Here is the list of packages that I'm installing in my Docker container
FROM python:3.10.14-bookworm AS baseRUN apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ apt-get update && apt-get install -y --no-install-recommends --fix-missing --fix-broken \ build-essential \ pkg-config \ libtool \ libicu-dev \ libcairo2-dev \ zlib1g-dev \ libncurses5-dev \ libgdbm-dev \ libnss3-dev \ libssl-dev \ libreadline-dev \ libffi-dev \ libsqlite3-dev \ libbz2-dev \ libavcodec-dev \ libavformat-dev \ libswscale-dev \ libglu1-mesa \ libx11-dev
Error while building container
51.58 E: Failed to fetch http://deb.debian.org/debian/pool/main/i/intel-mediasdk/libmfx1_22.5.4-1_amd64.deb Hash Sum mismatch51.58 Hashes of expected file:51.58 - SHA256:19754c2ad5cf13015ebe8e1bd7fbc412ca410d810c036b167ba2b0d9bee3692651.58 - MD5Sum:1de9514e785d87fa46d991b602887f6a [weak]51.58 - Filesize:3219328 [weak]51.58 Hashes of received file:51.58 - SHA256:2796856e746f49d952ef9bfba2c8735349571c85c0181578458822501efbb74851.58 - MD5Sum:bbe98cab38b7453c6f7fdc647dc722b3 [weak]51.58 - Filesize:3219328 [weak]51.58 Last modification reported: Tue, 18 Oct 2022 11:57:56 +000051.58 E: Failed to fetch http://deb.debian.org/debian-security/pool/updates/main/f/ffmpeg/libavutil57_5.1.5-0%2bdeb12u1_amd64.deb Hash Sum mismatch51.58 Hashes of expected file:51.58 - SHA256:e0ff2b085320a4688df1138289c4732a55bfbcb7f3428d3308cd057209853de851.58 - Filesize:363356 [weak]51.58 Hashes of received file:51.58 - SHA256:26aeda91fd6f9e1a5e6e8050837ebec9908fcceb63a6e8170117d75d1032738951.58 - Filesize:363356 [weak]51.58 Last modification reported: Sat, 15 Jun 2024 10:57:57 +000051.58 E: Sub-process /usr/bin/dpkg returned an error code (1)
Here is complete error log https://pastebin.com/13MmSUnu
Tried to install recommended missing packages, but it each time there is something new that is missing