Home > Back-end >  Couldn't import cv2 in SageMaker Studio Lab
Couldn't import cv2 in SageMaker Studio Lab

Time:01-03

I tried importing cv2 from opencv but i got error saying

import error: libgthread-2.0.so.0: cannot open shared object file: No such file or directory

Since Sagemaker Studio Labs doesn't support installation of Ubuntu packages i couldn't use apt-get or yum to install libglib2.0-0.

CodePudding user response:

With this line, you can install the glib dependency for Amazon Sagemaker Studio Lab. Just run it on your notebook cell.

! conda install glib=2.51.0 -y

You also can create another virtual environment for your session that contains glib:

! conda create -n glib-test -c defaults -c conda-forge python=3 glib=2.51.0` -y

After that maybe you need albumentations to import cv2:

! pip install albumentations
  • Related