1

I used to install opencv on my server using the conda yml file, as shown below

name: project_environment
dependencies:
- python=3.6.2
- pip=20.2.4

- pip:
  - pillow
  - numpy
  - opencv-python-headless==4.5.3.56
  - torch
  - torchvision
  - face-alignment==1.3.4
  - tensorflow==2.5.0
  - cmake
  - dlib
  
channels:
- anaconda
- conda-forge

Earlier, it used to work normally, but yesterday when i ran the script, i got the error

from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

This error was supposed to come if I install python-opencv, not in the headless version. How can i debug, which package is causing the issue.

Kazama
  • 61
  • 9
  • 1
    can you edit the question and add the output of `conda list -n project_environment --show-channel-urls`? That said, it looks like you may have so satisfy the libGL dependency with your system package manager. Why this error came up for you just now, I don't know. – cel Nov 26 '21 at 07:36

1 Answers1

0

Thank you skvark. Posting your suggestion as an answer to help other community members.

Other alternative is to run sudo apt-get install -y libgl1-mesa-dev which will provide the missing libGL.so.1 if you want to use opencv-python. The libgl1-mesa-dev package might be named differently depending on your GNU/Linux distribution.

You can refer to Error trying to import cv2(opencv-python) package, ImportError: libGL.so.1: cannot open shared object file: No such file or directory and ImportError: libGL.so.1: cannot open shared object file: No such file or directory

You can also refer to closed issue on GitHub: libGL.so.1: cannot open shared object file: No such file or directory

Ecstasy
  • 1,866
  • 1
  • 9
  • 17