I installed the OpenCV package by pip install opencv-python
.
When I import cv2 in my code.
import cv2
I got the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/tmp/ipykernel_324/571303353.py in <module>
----> 1 import cv2
~/.conda/envs/default/lib/python3.9/site-packages/cv2/__init__.py in <module>
6 import sys
7
----> 8 from .cv2 import *
9 from .cv2 import _registerMatType
10 from . import mat_wrapper
ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
Here are some solutions for this error but seemly need root permission.
apt-get update -y
apt-get install libglib2.0-0
When I run these commands in the terminal I got the following errors.
(studiolab) studio-lab-user@default:~/sagemaker-studiolab-notebooks/vit/ViT-pytorch$ apt-get update -y
Reading package lists... Done
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
This problem has been solved.
pip uninstall opencv-python
pip install opencv-python-headless
More details can be found in here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With