-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imshow gtk2 error on linux #43
Comments
And I do have these packages installed in my setup. |
In order to maintain compatibility, conda-forge opencv builds without gtk2 support (see #25 ). We have a conda-forge based recipe that builds with ffmpeg and gtk2 support on linux. You might want to use it to build your own opencv package, or you could use our prebuilt packages: conda install -c loopbio ffmpeg-feature gtk2-feature opencv Note that this last option installs, at the moment, our conda gtk2 package. You can remove it afterwards if you prefer to use your system's gtk2. |
Thx, I tried the prebuilt packages too, and it still gives me the same error. |
Maybe the package did not update to that in our our channel. What does
```conda list | grep opencv``` say?
…On 14/12/16 12:51, extraymond wrote:
Thx, I tried the prebuilt packages too, and it still gives me the same
error.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAnMzD8VQQSe8vjP6zxNKrcqguLCgAH5ks5rH9hEgaJpZM4LLUqH>.
|
It says this |
No, that was not coming from the loopbio repo. In fact we had not build the package for python 3. I have just uploaded the corresponding packages for python 3.x + numpy 1.11. Let me know if you need something different. If you succeed, you should see a line like this after running |
Actually I think I might be ok adding support for things like |
@sdvillal Hi I tried your gtk2-enabled opencv to compile Caffe. However, it complains that |
@sdvillal is the case that your opencv doesn't come with its own gtk? I think this is the case after examining the actual files. |
I'm using conda features to manage opencv variants, so if you want the gtk2 version, you need to install a package tracking the gtk2 feature. I know it is not very intuitive, but that is as good as it gets with conda right now. In our repo we have two packages that track the gtk2 feature: We are also packaging caffe. The following environment.yaml will create you an environment with opencv 3.2.0 compiled with gtk2 and ffmpeg support plus caffe compiled with cuda support. Note that cuda is not packaged, so you need to have it installed in your system (you get some hints on how to do so after the environment is created). name: caffecv
channels:
- loopbio # gtk2-feature, gtk2, ffmpeg-feature,
# opencv [gtk2, ffmpeg]
# cuda-feature, cudnn-feature, caffe [cuda, cudnn],
- conda-forge # everything else
- pkgw-forge # atk gdk2-pixbuf & deps
- defaults # in case anything is missing
dependencies:
- python
# Image proc libs
- gtk2 # for opencv
- ffmpeg-feature # for opencv
- ffmpeg # for opencv
- opencv
# Caffe-GPU
- cuda-feature
- cudnn-feature
- caffe-cuda
# Caffe-CPU
# - caffe Install, activate, list it like conda env create -f environment.yaml
source activate caffecv
conda list If everything has worked well, you should see lines like these in the package list
If you have more questions, feel free to open an issue in our opencv recipe repo. I think it is best to continue there the conversation. |
@jakirkham I do not know how easy could it be to get a gtk2-enabled version of opencv into conda-forge. First we would need to package gtk2 for linux (easy) mac (no idea) and windows (no idea), then deal with any problem given by opencv in these systems. If you think it would be really worth it, maybe we should ask for some advice to @pkgw - our gtk2 linux package depends on his excellent pkgw-forge packages and maybe we could start the job with a PR there. I think for ffmpeg it could be a bit easier, as the package is already in conda-forge. |
IMHO it should be ok to approach adding gtk2 incrementally. Namely start just with Linux where it is doable. We can then investigate other platforms. Honestly building things on Mac tends to be pretty similar to Linux and may only require a few tweaks. I agree that Windows can be tricky. That all being said, it is surprising how quickly people begin to rally around a package that is missing some OS support and start fixing it. Particularly with something as important as gtk2. |
@sdvillal thanks for the detailed explanation! Roughly at the same time, I figured out myself how to install your Gtk2-enabled package properly. Unfortunately, it seems that the portability of GTK is poor, in that https://github.com/yosinski/deep-visualization-toolbox fails to launch properly, or maybe it's because this toolbox actually requires opencv2 (not sure). I just tried recompiling one myself on Ubuntu, and it worked now. |
GTK is quite portable, including to Windows. If the problem you're seeing is due to the GTK package, it can almost surely be fixed. Does opencv support Gtk3? I have a set of recipes for the necessary Gtk3 packages in my |
@sdvillal @pkgw I've just compiled and tested a GTK-enabled opencv 2, for using https://github.com/yosinski/deep-visualization-toolbox on my university's cluster. It's at https://github.com/leelabcnbc/opencv-feedstock/tree/v2 and https://anaconda.org/zym1010/opencv. Hopefully we can somehow work together to merge these features into conda-forge. |
@zym1010 Your changes look good, and show that it is easy to build also a gtk2-enabled opencv linux version. I might also give a look to the v2 branch and add your changes. @pkgw I have not experience with opencv + gtk3, although I think that would not really cut it for some of our internal uses. As you comment, the problem with any of those is their dependencies on X11. Before finding your channel, I was solving it in dodgy ways at build time and hoping no problem would arise by using the system X11 libraries at deployment. I think adding gtk2 should not be a lot of extra work, as you have done already 95% of the work. I will open a PR to your conda-recipes repository to discuss. |
@zym1010 I have just uploaded opencv 2 gtk2 + ffmpeg to our channel, you could use that instead of your package. This is the relevant branch in our repo. I think it is better to keep this there to avoid a many fork mess. I would be happy to add any PR you might need. Just out of curiosity, are you planning to build conda packages also for caffe@deconv-deep-vis-toolbox and the deep-visualization-toolbox? It seems feasible to me. |
@sdvillal thanks! I think it would be best if you can help maintaining it, as I basically hack the original v2 branch for it to work for me, without much understanding of conda building framework.
Nope. In fact, for caffe@deconv-deep-vis-toolbox, I first merge it to the master branch of blvc/caffe and then compile it same way as I compile the master one. No error, and deep-visualization-toolbox doesn't need compiling. |
I thought the problem is the mix of packages, that probably were incompatible.I check my machine (Ubuntu 14.04 ) Anaconda environment there had a package name call opencv-python(https://pypi.python.org/pypi/opencv-python( Here, I got an IMPORTANT NOTE: MacOS and Linux wheels have some limitations: video related functionality is not supported (not compiled with FFmpeg) @sdvillal thanks for your information. |
@nafisfaysal the limitation should be due to the that of the PyPI package you use. I believe if you follow @sdvillal 's suggestion, you will be able to use a GUI-enabled opencv properly. |
Anyone got this working with the @sdvillal suggestion?
Even compiling by hand, with WITH_GTK=ON and CMAKE_INSTALL_PREFIX=/home/user/anaconda3 couldn't make it work... Did anyone got this working at all? |
how about
I think this should work. |
Or, if you do not have already gtk2 in your system:
conda install -c loopbio -c conda-forge -c pkgw-forge ffmpeg-feature ffmpeg gtk2 opencv
As long as you are using linux, this should get you all the dependencies needed.
Just a quick plug, we also compile opencv enabling all modern CPU instruction set extensions (but you need to have a modern CPU) and against libjpeg-turbo:
conda install -c loopbio -c conda-forge -c pkgw-forge ffmpeg-feature ffmpeg gtk2 opencv-turbo
And we also have a build adding some CUDA spices (but you need to install the CUDA 8 runtime yourself).
conda install -c loopbio -c conda-forge -c pkgw-forge ffmpeg-feature ffmpeg gtk2 opencv-turbo-cuda
Sorry for this little mess, as far as I know and as of today there is no way with conda to declare a package to provide "opencv" or conflict with other opencv packages other than using the magic of conda features.
…On 29/03/17 03:58, Yimeng Zhang wrote:
@oxydron <https://github.com/oxydron>
how about
|conda install -c loopbio -c conda-forge ffmpeg-feature gtk2-feature
opencv|?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAnMzKaVGgxVeMP9HqywPPQUcEe8TXfiks5rqbrBgaJpZM4LLUqH>.
|
Ups, email comments do not allow markdown. You could choose one of these variants: # Should work in any linux conda install
conda install -c loopbio -c conda-forge -c pkgw-forge ffmpeg-feature ffmpeg gtk2 opencv
# Should work anywhere with linux and a modern CPU
conda install -c loopbio -c conda-forge -c pkgw-forge ffmpeg-feature ffmpeg gtk2 opencv-turbo
# Should work anywhere with linux and a modern CPU and CUDA 8 + modern GPU
# (we only target Maxwell and Pascal)
conda install -c loopbio -c conda-forge -c pkgw-forge ffmpeg-feature ffmpeg gtk2 opencv-turbo-cuda |
@zym1010 Created a new conda env and run your install commands and got this, while trying to stat: No such file or directory
Gtk-Message: Failed to load module "overlay-scrollbar"
Gtk-Message: Failed to load module "atk-bridge"
Gtk-Message: Failed to load module "unity-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module" @sdvillal Created another env and run your first and second install commands and got this: Gtk-Message: Failed to load module "overlay-scrollbar"
Gtk-Message: Failed to load module "atk-bridge"
Gtk-Message: Failed to load module "unity-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module" and this [1] 22087 illegal hardware instruction (core dumped) python camera.py Am I cursed? |
Try only with the first command, that has the best chances to succeed. Did whatever program you run (camera.py?) actually fail? Those gtk messages do not need to imply failure - I have never seen them before, it looks like an ubuntu misconfiguration issue to me. Try perhaps to run this: import cv2
import numpy as np
cv2.imshow('darkness', np.zeros((100, 100)))
cv2.waitKey() To reduce noise, maybe it is better to continue discussion in a different issue here. Feel free to open it. |
@sdvillal I installed opencv in conda using your first command. I get the following error:
when I launch But, |
None of this represents a problem with the Please raise issues with the loopbio project directly if you are having trouble with their |
@jakirkham Thanks, and sorry for the extra traffic this generated. About GTK2, as a first step I have opened a pull request in the pkgw repo. The reason, it would require to add not only GTK2 to conda-forge, but several other X11 dependencies we pull from there. Having said that, even if we could make it one day into conda-forge, I wonder if it would be a good idea to make opencv depend on it. It really pulls a ton of dependencies, so at most I would make it optional (via a feature). Also, as you suffer, you will get every now and then some work from people alarmed by these GTK2 warnings. And for anybody like @kmario23 wondering about these GTK messages, note that 1) they are just warnings and 2) not related to our package (they would happen with any GTK2 application in your system). Please refer to this other issue to comment and find out how to silence them. |
This command ended up working for me (the commands suggested by @sdvillal did not) |
Guys the following repo gets you a updated with gtk version of OpenCV, it worked very well for me: |
@oxydron That's my channel and it won't be updated any further |
Thanks @sdvillal Ran this command and I got same error.
Ran this command and
Error:
Thanks @patricksnape 's |
I tried the command of @sdvillal and I've got the same error as @alwynmathew . Even more, when I now use
I try to roll-back... |
Please don't use this issue as a support group for the gtk build since we don't support it. Comment directly on the loopbio repository if you want support. |
Have opened issue ( conda-forge/staged-recipes#3914 ) to request GTK be added to |
After installing opencv from conda-forge, I'm able to import cv2 and use most of cv2's function.
But when trying to imshow after imread, I got an error suggesting I have built time problems.
error message below
The text was updated successfully, but these errors were encountered: