Installing OpenCV fails because it cannot find "skbuild"

Solution 1:

If you read the opencv-python package FAQ in PyPI, it clearly provides an answer for this specific issue: you must run pip install --upgrade pip. Check pip version afterwards with pip -V.

This is because your pip is too old to understand the new manylinux2014 package format and tries to compile from source. That will also fail because pip is too old to understand how to use pyproject.toml to install build dependencies such as scikit-build.

Another issue I'm spotting is that you install both opencv-python and opencv-contrib-python. You should not do this. It's also explained in the PyPI page of the packages. Most likely you should be using just opencv-contrib-python-headless package since you are using Docker and I assume you do not use the GUI functionalities of OpenCV.

Solution 2:

just update the pip and it will work

python -m pip install --upgrade pip

Solution 3:

Just update pip. If you use python3 then:

pip3 install --upgrade pip
pip3 install opencv-python