menpo / conda-opencv3

Automated building of OpenCV3 Python bindings
BSD 3-Clause "New" or "Revised" License
54 stars 17 forks source link

Links against libpng12, conda requirement is for libpng16 #20

Open takluyver opened 7 years ago

takluyver commented 7 years ago

On Linux, I installed opencv3 3.2.0 from this channel with Python 3.5. ldd libopencv_xobjdetect.so shows me:

libpng12.so.0 => /lib64/libpng12.so.0 

I.e. it's linking libpng12 from my system outside the conda env. The package itself specifies a dependency on libpng16 (libpng >=1.6.23,<1.7). As far as I know, conda can't install two versions of libpng in one environment, so this is hard to work around.

On systems with libpng12 installed outside conda, it seems to work correctly. @gamdow discovered this when trying to install on Ubuntu 16.10, which has dropped libpng12 from the repos. conda install opencv3 succeeds, but then the library can't be loaded because libpng12 is missing.

patricksnape commented 7 years ago

I'm trying to migrate this recipe to conda-forge, just failing at getting Windows builds going. Hopefully those builds should be more stable. OpenCV's build system is a disaster and is really hard to get working (particularly due to the contrib portion). I think I fixed that problem on the conda-forge repo already.

takluyver commented 7 years ago

Aha, thanks. We'll try with the package from conda-forge.

GabrielLin commented 7 years ago

@patricksnape Thank you for you reply. But the version of conda-forge is 3.1.0 . Could you please provide a 3.2.0 version please?

GabrielLin commented 7 years ago

@takluyver I try to install libpng12 outside conda by yum install libpng12 It seems that there is no error when importing.

takluyver commented 7 years ago

Yep, if you do that, it can find libpng12 on your system outside conda and load it.

oulenz commented 7 years ago

I have the same issue as the OP. After installing OpenCV from menpo, when I try to import cv2, I get

ImportError: libpng12.so.0: cannot open shared object file: No such file or directory

I didn't have this issue on my previous system and was wondering why I would run into this on a fresh installation, and now I realise why --- I upgraded to Ubuntu 16:10. :-/

Fortunately, it appears conda-forge is now adding builds with gtk2 support, as discussed in this thread. I receive warnings similar to those mentioned there, but no actual errors.

patricksnape commented 7 years ago

Actually we have no plans at the moment to build with GTK2. But you should use the conda-forge version rather than this one as I maintain both and have only done the 3.2.0 build on conda-forge.