Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: libSM.so.6: cannot open shared object file: No such file or directory

When trying to import OpenCV, using import cv2 I get the following error:

/usr/local/lib/python2.7/dist-packages/cv2/__init__.py in <module>()       7        8 # make IDE's (PyCharm) autocompletion happy ----> 9 from .cv2 import *      10       11 # wildcard import above does not import "private" variables like __version__  ImportError: libSM.so.6: cannot open shared object file: No such file or directory 

Not sure how to fix this - trying to play around with Google's new Colaboratory tool. Notebook is here: https://drive.google.com/file/d/0B7-sJqBiyjCcRmFkMzl6cy1iN0k/view?usp=sharing

like image 481
Dmitry Rastorguev Avatar asked Nov 04 '17 16:11

Dmitry Rastorguev


2 Answers

This fixed the problem by having it as the first two lines of the script:

!pip install opencv-python !apt update && apt install -y libsm6 libxext6 !apt-get install -y libxrender-dev 
like image 196
Dmitry Rastorguev Avatar answered Sep 21 '22 21:09

Dmitry Rastorguev


You need to add sudo . I did the following to get it installed :

sudo apt-get install libsm6 libxrender1 libfontconfig1 

and then did that (optional! maybe you won't need it)

sudo python3 -m pip install opencv-contrib-python 

FINALLY got it done !

like image 39
smerllo Avatar answered Sep 21 '22 21:09

smerllo