Incompatibility with Numpy 1.x

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

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
numpy, opencv, python
Domain
build-system

Research direction

The report identifies opencv-python-headless==4.12.0.88 and its pip metadata, but no repository file or test. Start by inspecting the wheel's NumPy requirement and the package's build and release configuration, then reproduce installation with NumPy 1.x; done means the supported constraint is validated without breaking the published wheel.

Written by the indexing model from the issue text.

Description

Starting with opencv-python-headless==4.12.0.88, pip reports incompatibility with numpy<2.

pip output
# pip install opencv-python-headless==4.12.0.88
Collecting opencv-python-headless==4.12.0.88
  Using cached opencv_python_headless-4.12.0.88-cp37-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (19 kB)
Collecting numpy<2.3.0,>=2 (from opencv-python-headless==4.12.0.88)
  Using cached numpy-2.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (62 kB)
Using cached opencv_python_headless-4.12.0.88-cp37-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (54.0 MB)
Using cached numpy-2.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
Installing collected packages: numpy, opencv-python-headless
  Attempting uninstall: numpy
    Found existing installation: numpy 1.26.4
    Uninstalling numpy-1.26.4:
      Successfully uninstalled numpy-1.26.4
  Attempting uninstall: opencv-python-headless
    Found existing installation: opencv-python-headless 4.13.0.92
    Uninstalling opencv-python-headless-4.13.0.92:
      Successfully uninstalled opencv-python-headless-4.13.0.92
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
atom 0.4.0 requires numpy==1.26.4, but you have numpy 2.2.6 which is incompatible.

This is an issue for me, because I'm stuck on numpy 1.x for other reasons. I think that the opencv numpy constraint could be relaxed, however. From the numpy docs:

When you build wheels for your package using a NumPy 2.x version at build time, those will work with NumPy 1.xx.
https://numpy.org/doc/2.0/dev/depending_on_numpy.html#numpy-2-0-specific-advice

Is there some other reason that I'm not aware for the incompatibility? Otherwise, I can open a PR for this.

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

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.

More from opencv/opencv-python

All issues in opencv/opencv-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.