Question
Asked By – Dmitry Rastorguev
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
Now we will see solution for issue: ImportError: libSM.so.6: cannot open shared object file: No such file or directory
Answer
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
This question is answered By – Dmitry Rastorguev
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0