'Can't install opencv-python build dependencies on python2.7 inside alpine

I am having immense difficulty getting opencv-python to install on alpine. I have tried:

  • Installing opencv-python==4.2.0.32
  • Using ubuntu instead of alpine
  • Directly building from git repo and making it.
  • Tried to install alpine build requirements. gcc musl-dev python3-dev libffi-dev openssl-dev cargo alpine-sdk cmake libressl-dev libffi-dev etc

I always get a different error.

    The following tests FAILED:
         60 - ExportImport (Failed)
    Errors while running CTest
    make[2]: *** [CMakeFiles/CMakeProject-build.dir/build.make:127: CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-run_cmake_test_suite] Error 8
    make[1]: *** [CMakeFiles/Makefile2:117: CMakeFiles/CMakeProject-build.dir/all] Error 2
    make: *** [Makefile:136: all] Error 2
      File "/tmp/pip-build-env-1u82xj/overlay/lib/python2.7/site-packages/skbuild/setuptools_wrap.py", line 645, in setup
        cmkr.make(make_args, install_target=cmake_install_target, env=env)
      File "/tmp/pip-build-env-1u82xj/overlay/lib/python2.7/site-packages/skbuild/cmaker.py", line 660, in make
        self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
      File "/tmp/pip-build-env-1u82xj/overlay/lib/python2.7/site-packages/skbuild/cmaker.py", line 699, in make_impl
        os.path.abspath(CMAKE_BUILD_DIR()),
  
    Traceback (most recent call last):
  
    An error occurred while building with CMake.
      Command:
        cmake --build . --target install --config Release --
      Install target:
        install
      Source directory:
        /tmp/pip-install-HnqxAE/cmake
      Working directory:
        /tmp/pip-install-HnqxAE/cmake/_skbuild/linux-aarch64-2.7/cmake-build
    Please check the install target is valid and see CMake's output for more information.
    ----------------------------------------
    ERROR: Failed building wheel for cmake
  Failed to build cmake
  ERROR: Could not build wheels for cmake which use PEP 517 and cannot be installed directly
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2.7 /usr/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-Z3nLDB/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.11.3; python_version=='"'"'3.5'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"'' Check the logs for full command output.

I am also using arm architecture MacBook pro



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source