opencv / opencv/opencv-python

Why Building wheel for opencv-python when using "pip install opencv-python"

Open
#1,009 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

System Information

OS: MacOS
opencv: Any version

Detailed description

Hello, Why does Building wheel for opencv-python work when I use "pip install opencv-python"?
Now whether I install the new environment using anaconda or install it again after uninstall opencv in the original environment, I get the steps shown below! This is completely different from my previous pip install, which didn't build before. But I don't have this problem when installing via the ".whl" file. I'm macOS and my first question is: what should I change to make my pip install opencv-python as easy and fast as before without compiling from scratch. It's too slow to compile this way。
1216347367

Meanwhile pip install opencv-python, since it now has to be compiled from scratch, in addition to being a particularly slow installer has a problem that I am very puzzled by. This problem exists both when I compile opencv myself via cmake and when I make opencv-contrib available for C++. Both my own compilation of opencv (for C++) and pip's rebuild of opencv-python have no way to read png files!

C++ builds with cmake and this problem occurs whether I tick "WITH_PNG" or not:
image

It's worth mentioning that my system's libpng version itself is 1.6.39, so why does opencv, which is compiled for C++ with and without "WITH_PNG" checked, have this problem when reading png?
image

Also the previous pip install of opencv was able to read png images correctly with python's opencv since it wasn't compiled from scratch, but now since the install is going to be rebuilt, I'm getting this problem when reading opencv through python.

So my two questions in a nutshell are (1) how do I restore the normal flow of my opencv-python when installed using pip without having to compile from scratch?

(2) How to fix the problem that my own compiled opencv cannot read png images

Looking forward to your answers and help, thank you very much!

Steps to reproduce
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or reproducible code are provided. Start by reproducing pip install opencv-python on macOS and checking whether a compatible wheel is selected, then inspect the CMake build's PNG support with and without WITH_PNG. Done means documenting the cause of the source build and restoring PNG reading in the relevant installations.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python
Domain
build-system, computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.