ImportError: libSM.so.6: cannot open shared object file: No such file or directory
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
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 !
For CentOS, run this:
sudo yum install libXext libSM libXrender