0

I am trying to use pyinstaller to package a simple python script that imports cv2 module and all this should be done inside a docker container (this is part of a Gitlab CI/CD pipeline).

I think I am doing this right in the right order, i.e.

  • start a docker python image,
  • then I can run apt-get install -y python3-opencv
  • pip install opencv-python
  • pip install pyinstaller
  • pyinstaller -F sample.py

sample.py can be

import cv2
print("hello")

When I run the resulting executable I get the error: ImportError: libGL.so.1: cannot open shared object file: No such file or directory

I've tried locating this library and adding to --paths option for pyinstaller but iwht no luck. Any help is appreciated

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
gota
  • 2,338
  • 4
  • 25
  • 45
  • 1
    use a headless variant of the opencv-python package. – Christoph Rackwitz Oct 18 '22 at 15:39
  • Does this answer your question? [Unable to run docker image due to libGl error](https://stackoverflow.com/questions/63889102/unable-to-run-docker-image-due-to-libgl-error) – Christoph Rackwitz Oct 18 '22 at 15:39
  • All the provided solutions didn't work for me... but in the end I didn't use a docker image, and I am using a virtual environment and that solved my issue. I'll leave this uestion open as maybe in the future someone finds a solution to this – gota Oct 19 '22 at 09:24

0 Answers0