Encountered an error when “import cv2″ in Jupyterhub. This is a memo to solve it.

ImportError: libgtk-x11-2.0.so.0: cannot open shared object file:No such file or directory

Amazon AMI doesn’t have a yum repo for the libgtk-x11-2.0.so.0. So, needed to install other distro packages. In this case, did used CentOS.

$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/hicolor-icon-theme-0.11-1.1.el6.noarch.rpm

$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/atk-1.30.0-1.el6.x86_64.rpm

$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/gdk-pixbuf2-2.24.1-6.el6_7.x86_64.rpm

$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/gtk2-2.24.23-9.el6.x86_64.rpm

Lack of packages has been filled, reboot it. That’s it.