Python package version not found, but it's clearly there

Question:

I am trying to create specific python environment inside docker for reproducible builds, but package python-opencv that previously was manually installed refuses to get installed with error:

ERROR: Could not find a version that satisfies the requirement opencv_python==4.7.0 (from versions: 3.4.0.14, 3.4.10.37, 3.4.11.39, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.15.55, 3.4.16.57, 3.4.16.59, 3.4.17.61, 3.4.17.63, 3.4.18.65, 4.3.0.38, 4.4.0.40, 4.4.0.42, 4.4.0.44, 4.4.0.46, 4.5.1.48, 4.5.3.56, 4.5.4.58, 4.5.4.60, 4.5.5.62, 4.5.5.64, 4.6.0.66, 4.7.0.68)

ERROR: No matching distribution found for opencv_python==4.7.0

Command was:

pip3 install face_recognition==1.3.0 opencv_python==4.7.0

Inside docker: ubuntu 22.04; Python 3.10.6; pip 22.0.2

Why pip3 cannot find opencv_python version 4.7.0 since it’s clearly in the list of available packages? What’s the best way to create reproducible python environment when building docker image?

Asked By: Slaus

||

Answers:

You need to specify the exact version, so:

opencv_python==4.7.0.68

Otherwise, you can ask for approximate versions using one of the following:

opencv_python~=4.7.0
opencv_python==4.7.0.*
Answered By: Drphoton
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.