Docker-stacks: Trying to install opencv but import cv2 fails with "ImportError: libgtk-x11-2.0.so.0: cannot open shared object file"

Created on 29 Jun 2016  路  18Comments  路  Source: jupyter/docker-stacks

I've installed OpenCV3 with conda install -c menpo opencv3=3.1.0. This works perfectly well on Mac OSX, but in this image it installs okay but when I try to use it like below it fails:

$ python
>>> import cv2

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

I've tried apt-get install libgtk2.0 but nothing happens. This SO post says it works on Ubuntu: http://askubuntu.com/questions/761589/installing-libgtk-x11-2-0-so-0-in-ubuntu-15-04

Any ideas..? Or has anyone got OpenCV to work in these containers?

I launch my container with (based on jupyter/scipy-notebook):

$ docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -v $(pwd):/home/jovyan/work -p 8888:8888 -t -i opencv3

Most helpful comment

Ignore me... Stupid n00b mistake. After doing apt-get update then apt-get install libgtk2.0-dev it worked fine. ;-)

All 18 comments

Ignore me... Stupid n00b mistake. After doing apt-get update then apt-get install libgtk2.0-dev it worked fine. ;-)

That helps! THanks!

thanks

thanks a lot :+1:

Thanks!

Thanks!

thanks a lot 馃憤

Thaks!!

thanks !

thanks !

thanks!!

For what it's worth, there's a opencv package on conda-forge that might just work when installed with conda install -c conda-forge opencv in an image build or container now.

thanks!

thanks a lot锛侊紒

Thanks that helps 馃憤

thanks!

Thanks a lot!

For what it's worth, there's a opencv package on conda-forge that might just work when installed with conda install -c conda-forge opencv in an image build or container now.
@peterprescott

I was trying to use cv2 on a cluster without sudo permission. conda install -c conda-forge opencv works. Thanks!

Was this page helpful?
0 / 5 - 0 ratings