0

I'm relatively new to image analysis and I want to import the CV2 package. When I run the code import cv2 I receive the following error code:

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

I've looked at answers like this: ImportError: libGL.so.1: cannot open shared object file: No such file or directory

But when I do, the solutions doesn't work For example one solution suggested to run apt-get update && apt-get install -y python3-opencv, but again, when I do, the code does not run. I already tried to uninstall the packages but still the same error.

Someone know a solution?

Jeru Luke
  • 20,118
  • 13
  • 80
  • 87

2 Answers2

0

You may not have it installed via PyPi. I don't know CV2, but should be able to help you. First, go to https://pypi.org and search for the CV2 package because I don't know which one you are trying to use. Then click the copy button next to the console command and go to your command prompt or terminal and paste it there.

Hex
  • 59
  • 1
  • 12
  • I used ```pip install opencv-python``` to instal openCV where cv2 is part of. But still get the same error message... – Paul Engelbert Mar 19 '22 at 12:26
  • I just checked their PyPI page, they have more advanced install instructions and it says to make sure you did all of these if you get any other import errors. – Hex Mar 20 '22 at 13:16
0

remove opencv from your environment first. run

apt-get update && apt-get install libgl1

and then "pip install python3-opencv

sharktooth
  • 33
  • 1
  • 6