Python scikit-build & skbuild

Scikit-build is a Python module for generating build systems for packages containing compiled Python extensions. The module itself is named skbuild while the package is scikit-build.

flowchart LR
  A[setup.py] -- skbuild --> B[CMakeLists.txt]
  B -- CMake --> C[Makefile]
  C -- Make --> D[executable code]
  E[extension source code] -- compiler -->D 

One of the most popular packages using scikit-build is OpenCV, specifically the Python binding, which has a large ecosystem of related and dependent Packags.

It can be installed using the command:

pip install scikit-build

Problems with skbuilt are often related to older versions of pip or older distribution. A typical error is, for example:

RUN pip3 install opencv-python opencv-contrib-python
...
...

Command "/usr/bin/python3 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-erfh4usi --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- cmake>=3.1 "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'" "numpy==1.17.0; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'" "numpy==1.17.5; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'" "numpy==1.19.3; python_version<'3.9' and sys_platform == 'linux' and platform_machine == 'aarch64'" "numpy==1.21.0; python_version<'3.9' and sys_platform == 'darwin' and platform_machine == 'arm64'" "numpy>=2.0.0;  python_version>='3.9'" pip scikit-build>=0.14.0 setuptools==59.2.0" failed with error code 2 in None
Error: building at STEP "RUN pip3 install opencv-python opencv-contrib-python": while running runtime: exit status 1

Generally they can be fixed by correct installation of the necessary dependencies and correct configuration. Errors reported such as ModuleNotFoundError: No module named 'skbuild' are typically also related to older pip versions.

We can assist in building binaries for OpenCV on any Linux version.

Copyright and published by: Software Build Factory (C) 2024 Contact info@softwarebuildfactory.com