I'm trying to install opencv-python 4.5.5.62 and numpy 1.19.5 with poetry, but poetry doesn't allow it. After adding opencv-python to poetry project, poetry returns error when adding numpy:
$ poetry add numpy==1.19.5
Because example depends on opencv-python (4.5.5.62) which depends on numpy (>=1.21.2), numpy is required.
So, because example depends on numpy (1.19.5), version solving failed.
While using linux and Python 3.9.7 like me, numpy 1.19.5 should be allowed to install alongside with opencv-python 4.5.5.62, as it's described in pypi requirements:
$ curl -s https://pypi.org/pypi/opencv-python/4.5.5.62/json | jq '.info.requires_dist'
[
"numpy (>=1.13.3) ; python_version < \"3.7\"",
"numpy (>=1.21.2) ; python_version >= \"3.10\"",
"numpy (>=1.21.2) ; python_version >= \"3.6\" and platform_system == \"Darwin\" and platform_machine == \"arm64\"",
"numpy (>=1.19.3) ; python_version >= \"3.6\" and platform_system == \"Linux\" and platform_machine == \"aarch64\"",
"numpy (>=1.14.5) ; python_version >= \"3.7\"",
"numpy (>=1.17.3) ; python_version >= \"3.8\"",
"numpy (>=1.19.3) ; python_version >= \"3.9\""
]
It is possible to install mentioned versions with pip
. Pip's logs show that actual numpy requirement for opencv is lower that poetry's:
$ pip3 install opencv-python
Collecting opencv-python
Using cached opencv_python-4.6.0.66-cp36-abi3-macosx_10_15_x86_64.whl (46.4 MB)
Collecting numpy>=1.17.3
Using cached numpy-1.23.2-cp38-cp38-macosx_10_9_x86_64.whl (18.1 MB)
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.23.2 opencv-python-4.6.0.66
The same problem is on ubuntu 18.04 and macOS 12.4 (Intel) with Python versions 3.8.10, 3.9.7.