Problem installing opencv on FreeBSD

Hi,
I’m installing opencv on FreeBSD as :

pip install opencv-python-headless
or 
pip install opencv-python

I tried both separately… and both gives me same error, here it is :

                   Start 374: RunCMake.FeatureSummary
            368/605 Test #374: RunCMake.FeatureSummary ...........................   Passed    0.39 sec
                    Start 375: RunCMake.FPHSA
            369/605 Test #375: RunCMake.FPHSA ....................................   Passed    0.52 sec
                    Start 376: RunCMake.FileAPI
            370/605 Test #376: RunCMake.FileAPI ..................................   Passed    1.49 sec
                    Start 377: RunCMake.FindBoost
            371/605 Test #377: RunCMake.FindBoost ................................***Failed    0.38 sec
            -- CMakePackage - PASSED
            -- NoCXX - PASSED
            -- LegacyVars-TargetsDefined - PASSED
            -- LegacyVars-LowercaseTargetPrefix - PASSED
            -- LegacyVars-NoHeaderTarget - PASSED
            -- MissingTarget - PASSED
            -- ConfigMode - PASSED
            -- ModuleMode - PASSED
            CMake Error at /tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/CMake-src/Tests/RunCMake/RunCMake.cmake:219 (message):
              ConfigModeNotFound - FAILED:

              Result is [1], not [0].

              Command was:

               command> "/tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/_skbuild/freebsd-13.1-RELEASE-amd64-3.9/cmake-build/CMakeProject-build/bin/cmake" "/tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/CMake-src/Tests/RunCMake/FindBoost" "-G" "Ninja" "-DRunCMake_TEST=ConfigModeNotFound" "--no-warn-unused-cli" "-DCMAKE_MAKE_PROGRAM=/usr/local/bin/ninja"

              Actual stdout:

               actual-out> Not searching for unused variables given on the command line.
               actual-out> -- Boost toolset is unknown (compiler  )
               actual-out> -- Boost toolset is unknown (compiler  )
               actual-out> -- Could NOT find Boost: missing: foobar (found /usr/local/lib/cmake/Boost-1.80.0/BoostConfig.cmake (found suitable version "1.80.0", minimum required is "1.80"))
               actual-out> -- Configuring incomplete, errors occurred!
               actual-out> See also "/tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/_skbuild/freebsd-13.1-RELEASE-amd64-3.9/cmake-build/CMakeProject-build/Tests/RunCMake/FindBoost/ConfigModeNotFound-build/CMakeFiles/CMakeOutput.log".

              Actual stderr:

               actual-err> CMake Error at /usr/local/lib/cmake/BoostDetectToolset-1.80.0.cmake:5 (string):
               actual-err>   string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
               actual-err>   command.
               actual-err> Call Stack (most recent call first):
               actual-err>   /usr/local/lib/cmake/boost_timer-1.80.0/boost_timer-config.cmake:29 (include)
               actual-err>   /usr/local/lib/cmake/Boost-1.80.0/BoostConfig.cmake:141 (find_package)
               actual-err>   /usr/local/lib/cmake/Boost-1.80.0/BoostConfig.cmake:262 (boost_find_component)
               actual-err>   /tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/CMake-src/Modules/FindBoost.cmake:594 (find_package)
               actual-err>   CommonNotFound.cmake:2 (find_package)
               actual-err>   ConfigModeNotFound.cmake:2 (include)
               actual-err>   CMakeLists.txt:3 (include)
               actual-err>
               actual-err>
               actual-err> CMake Error at /usr/local/lib/cmake/BoostDetectToolset-1.80.0.cmake:5 (string):
               actual-err>   string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
               actual-err>   command.
               actual-err> Call Stack (most recent call first):
               actual-err>   /usr/local/lib/cmake/boost_chrono-1.80.0/boost_chrono-config.cmake:29 (include)
               actual-err>   /usr/local/lib/cmake/boost_timer-1.80.0/boost_timer-config.cmake:102 (find_package)
               actual-err>   /usr/local/lib/cmake/Boost-1.80.0/BoostConfig.cmake:141 (find_package)
               actual-err>   /usr/local/lib/cmake/Boost-1.80.0/BoostConfig.cmake:262 (boost_find_component)
               actual-err>   /tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/CMake-src/Modules/FindBoost.cmake:594 (find_package)
               actual-err>   CommonNotFound.cmake:2 (find_package)
               actual-err>   ConfigModeNotFound.cmake:2 (include)
               actual-err>   CMakeLists.txt:3 (include)

            Call Stack (most recent call first):
              /tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/CMake-src/Tests/RunCMake/FindBoost/RunCMakeTest.cmake:21 (run_cmake)


            -- ModuleModeNotFound - PASSED
            -- CMP0093-NEW - PASSED
            -- CMP0093-OLD - PASSED
            -- CMP0093-UNSET - PASSED

            372/605 Test #351: RunCMake.Ninja ....................................   Passed   77.12 sec

            99% tests passed, 1 tests failed out of 372

            Label Time Summary:
            CMake      = 146.23 sec*proc (64 tests)
            CUDA       =  11.36 sec*proc (4 tests)
            HIP        =   0.18 sec*proc (1 test)
            ISPC       =   0.18 sec*proc (1 test)
            Label1     =   0.02 sec*proc (1 test)
            Label2     =   0.02 sec*proc (1 test)
            command    =   0.00 sec*proc (0 test)
            policy     =  30.01 sec*proc (37 tests)
            run        = 146.23 sec*proc (64 tests)

            Total Test time (real) = 226.79 sec

            The following tests FAILED:
                377 - RunCMake.FindBoost (Failed)
            Errors while running CTest
            FAILED: CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-run_cmake_test_suite /tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/_skbuild/freebsd-13.1-RELEASE-amd64-3.9/cmake-build/CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-run_cmake_test_suite
            cd /tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/_skbuild/freebsd-13.1-RELEASE-amd64-3.9/cmake-build/CMakeProject-build && ./bin/ctest --force-new-ctest-process --stop-on-failure --output-on-failure -j2 -E BootstrapTest && /usr/local/bin/cmake -E touch /tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/_skbuild/freebsd-13.1-RELEASE-amd64-3.9/cmake-build/CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-run_cmake_test_suite
            ninja: build stopped: subcommand failed.
            Traceback (most recent call last):
              File "/tmp/pip-build-env-9pdje3ze/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 649, in setup
                cmkr.make(make_args, install_target=cmake_install_target, env=env)
              File "/tmp/pip-build-env-9pdje3ze/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 686, in make
                self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
              File "/tmp/pip-build-env-9pdje3ze/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 717, in make_impl
                raise SKBuildError(


                =============================DEBUG ASSISTANCE=============================
                If you are seeing a compilation error please try the following steps to
                successfully install cmake:
                1) Upgrade to the latest pip and try again. This will fix errors for most
                   users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
                2) If on Linux, with glibc < 2.12, you can set PIP_ONLY_BINARY=cmake in
                   order to retrieve the last manylinux1 compatible wheel.
                3) If on Linux, with glibc < 2.12, you can cap "cmake<3.23" in your
                   requirements in order to retrieve the last manylinux1 compatible wheel.
                4) Open an issue with the debug information that follows at
                   https://github.com/scikit-build/cmake-python-distributions/issues

                Python: 3.9.16
                platform: FreeBSD-13.1-RELEASE-amd64-64bit-ELF
                machine: amd64
                bits: 64
                pip: n/a
                setuptools: 67.1.0
                scikit-build: 0.16.6
                PEP517_BUILD_BACKEND=setuptools.build_meta
                =============================DEBUG ASSISTANCE=============================

            An error occurred while building with CMake.
              Command:
                /usr/local/bin/cmake --build . --target install --config Release --
              Install target:
                install
              Source directory:
                /tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe
              Working directory:
                /tmp/pip-install-mymszozf/cmake_b241ca11551145be876a43e108d7aafe/_skbuild/freebsd-13.1-RELEASE-amd64-3.9/cmake-build
            Please check the install target is valid and see CMake's output for more information.
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for cmake
      Failed to build cmake
      ERROR: Could not build wheels for cmake, which is required to install pyproject.toml-based projects
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

What can I do?

Thanks

get OpenCV sources, build it yourself. you are using something other than Linux or Windows, so do not expect this to go smoothly.

OpenCV always contains Python bindings. the “opencv-python” repo contains no actual code. it only contains information required to build wheels for redistribution. you don’t need that if you build OpenCV yourself.