Skip to content
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

Turn back on Qt support for macOS #540

Open
4 tasks done
daveisfera opened this issue Sep 8, 2021 · 9 comments
Open
4 tasks done

Turn back on Qt support for macOS #540

daveisfera opened this issue Sep 8, 2021 · 9 comments

Comments

@daveisfera
Copy link

daveisfera commented Sep 8, 2021

Expected behaviour

Qt support is still used on macOS

Actual behaviour

Cocoa support is used so advanced functionality (like zooming) isn't available

Steps to reproduce

  • example code pip install opencv-python
  • operating system 11.5.2
  • architecture (e.g. x86) x86
  • opencv-python version 4.5.3.56

Related to #376 and #423

Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python

I'd like to help get the Qt support turned back on. Qt 5.15.2 is available now and there were 56 macOS bug fixes in 5.15.1 and then 11 macOS bug fixes in 5.15.2, so I'm hopeful that the issue is resolved and turning back on Qt support would work again

@asmorkalov
Copy link
Collaborator

Qt back-end is heavy dependency to build, maintain and update for each MacOS version. Also the dependency raises conflict with other Qt-based packages like PyQT. OpenCV team does not plan to step back to Qt back-end in nearest future without strong technical reason or strong community demand. As alternative you can build own instance of package with custom dependencies.

@mshabunin
Copy link

I believe OpenCV in conda-forge uses Qt:

# install miniconda
conda create -n opencv -c conda-forge opencv
conda activate opencv
python -c 'import cv2; print(cv2.getBuildInformation())'

@daveisfera
Copy link
Author

I definitely agree that Qt is a heavy dependency, but it also adds several very useful features to the image viewer (the zoom and pan is what I use the most), so I'd love to see it turned back on because I prefer being able to use software from pip whenever possible to keep things portable and simple

@skvark
Copy link
Member

skvark commented Sep 13, 2021

To build a custom version with your own dependencies (including Qt): pip install --no-binary opencv-python opencv-python

Check readme for more detailed build instructions: https://github.com/opencv/opencv-python#manual-builds

@daveisfera
Copy link
Author

For a custom build to add Qt support, wouldn't the removed code/build need to be put back and a flag added to enable it?

@skvark
Copy link
Member

skvark commented Sep 15, 2021

For a custom build to add Qt support, wouldn't the removed code/build need to be put back and a flag added to enable it?

I'm not sure if I follow, but if CMake does not find Qt (or other dependencies) from your system automatically, then you'll need to provide custom flags such as WITH_QT=5 etc. before the build command.

@daveisfera
Copy link
Author

Doesn't this commit remove the ability to build with Qt?

@skvark
Copy link
Member

skvark commented Sep 18, 2021

No, it doesn't. All those lines are related to the CI build in this repository when CI_BUILD flag has been set to true. They are run only on CI to create the portable wheel packages.

See:

if is_CI_build:

Local builds can be configured freely to include anything you wish. By default setup.py (which is executed when you call pip install --no-binary opencv-python opencv-python) runs the OpenCV CMake script which will enable all dependencies it can find from your system.

@alalek
Copy link
Member

alalek commented Sep 18, 2021

BTW, Qt automatic searching is disabled by default in OpenCV upstream repo: https://github.com/opencv/opencv/blob/4.5.3/CMakeLists.txt#L332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants