opencv-python icon indicating copy to clipboard operation
opencv-python copied to clipboard

opencv-python-headless package relies on numpy below 2.3.0 ?

Open wyatt-wong opened this issue 3 months ago • 7 comments

I installeed the pdf2docx package but found that it relies on opencv-python-headless package and the opencv-python-headless relies on the older numpy package below 2.3.0 ?

Can opencv-python-headless package update to support numpy > 2.3.0 ? The latest numpy package is 2.3.2 as at 04-Sep-2025.

wyatt-wong avatar Sep 04 '25 08:09 wyatt-wong

Same issue. I can not install picamera2 and opencv-python on my RPI 5 because of the issue.

kvrban avatar Sep 09 '25 13:09 kvrban

Testing Results: Python 3.10 vs 3.11 numpy Compatibility

I've tested the numpy version conflict across Python environments and found the root cause:

Python 3.10.18:

  • numpy 2.3.2: ❌ Cannot install (requires Python ≥3.11)
  • Final result: numpy 2.2.6 + opencv-python-headless 4.12.0.88 ✅
Image Image

Python 3.11:

  • numpy 2.3.2: ✅ Installs successfully initially
  • But when installing pdf2docx: pip downgrades numpy 2.3.2 → 2.2.6
  • Final result: numpy 2.2.6 + opencv-python-headless 4.12.0.88 ✅
Image Image Image

Root Cause Identified: The conflict occurs because opencv-python-headless restricts numpy<2.3.0, while newer packages (like pdf2docx) work best with numpy ≥2.3.0. Pip resolves this by downgrading numpy.

Proposed Solution: Update opencv-python-headless to use conditional numpy requirements:

  • Python <3.11: numpy>=1.17.2,<2.3.0 (current behavior)
  • Python ≥3.11: numpy>=1.17.2,<2.4.0 (allow 2.3.x)

Next Steps: I can test opencv functionality with numpy 2.3.x on Python 3.11+ and prepare a PR if maintainers are interested.

@wyatt-wong @kvrban - Does this match what you're experiencing? What Python versions are you using?

Shiv-Expert2503 avatar Sep 14 '25 07:09 Shiv-Expert2503

Testing Results: Python 3.10 vs 3.11 numpy Compatibility

I've tested the numpy version conflict across Python environments and found the root cause:

Python 3.10.18:

  • numpy 2.3.2: ❌ Cannot install (requires Python ≥3.11)
  • Final result: numpy 2.2.6 + opencv-python-headless 4.12.0.88 ✅
Image Image

Python 3.11:

  • numpy 2.3.2: ✅ Installs successfully initially
  • But when installing pdf2docx: pip downgrades numpy 2.3.2 → 2.2.6
  • Final result: numpy 2.2.6 + opencv-python-headless 4.12.0.88 ✅
Image Image Image

Root Cause Identified: The conflict occurs because opencv-python-headless restricts numpy<2.3.0, while newer packages (like pdf2docx) work best with numpy ≥2.3.0. Pip resolves this by downgrading numpy.

Proposed Solution: Update opencv-python-headless to use conditional numpy requirements:

  • Python <3.11: numpy>=1.17.2,<2.3.0 (current behavior)
  • Python ≥3.11: numpy>=1.17.2,<2.4.0 (allow 2.3.x)

Next Steps: I can test opencv functionality with numpy 2.3.x on Python 3.11+ and prepare a PR if maintainers are interested.

@wyatt-wong @kvrban - Does this match what you're experiencing? What Python versions are you using?

I am using Python 3.13.7, I already knew installed pdf2docx automatically downgrade numpy 2.26, that's why I raised this issue and see if the maintainer of opencv-python-headless can verify if it can works with numpy 2.3.2 and if so modify the requirements.txt file of opencv-python-headless accordingly. Or else update opencv-python-headless so that it is compatible to numpy 2.3.2

I have also installed numpy 2.3.2 using pip-review -a (pip-review) but i can't confirm if opencv-python-headless have any conflicts with numpy 2.3.2 or not.

Note further that according to the Python release notes, it is very likely that python 3.14 will come next after Python 3.13.7, which means python 3.13.7 could be the last maintenance release of python 3.13

wyatt-wong avatar Sep 14 '25 09:09 wyatt-wong

This is now also preventing the usage of Python 3.14 which needs the newest Numpy, please update!

Houbein avatar Sep 21 '25 20:09 Houbein

This is now also preventing the usage of Python 3.14 which needs the newest Numpy, please update!

#1142 was just approved

vfazio avatar Sep 21 '25 20:09 vfazio

Esto ahora también impide el uso de Python 3.14, que necesita la versión más nueva de Numpy. ¡Actualice!

#1142 acaba de ser aprobado

https://github.com/opencv/opencv-python/issues/1135#issuecomment-3448473109

faverl avatar Oct 26 '25 23:10 faverl

I'm on Apple Silicon and other packages that my project uses are happy with the latest numpy. I use python 3.13 .

opencv-python 4.12.0.88 requires numpy<2.3.0,>=2; python_version >= "3.9", but you have numpy 2.3.5 which is incompatible.

What are the plans for moving to the latest numpy branch?

jrp2014 avatar Dec 07 '25 22:12 jrp2014