Cannot install Open-CV

I am using Python on my Raspberry Pi 4B running Bullseye.

*****@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Static hostname: raspberrypi
Icon name: computer
Machine ID: d6f00b01670b4dad8366c0004d859a63
Boot ID: 5ca54ba5fe234c6096b37f0a2e6b0af5
Operating System: Raspbian GNU/Linux 11 (bullseye)
Kernel: Linux 6.1.19-v8+
Architecture: arm64

I am trying to install Open-CV to use the library for a project I am working on. I have tried the following methods to install:

pip install opencv-python
pip3 install opencv-python
sudo apt install -y opencv-python
sudo apt install -y python3-opencv

and I am sure I am missing a few other methods I have tried.

The error, every time:

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

Yes, I have tried updating pip. I used

pip install --upgrade pip
pip3 install --upgrade pip
pip install --upgrade pip setuptools wheel
pip3 install --upgrade pip setuptools wheel

How do I get opencv installed? What am I missing? Thank you in advance for your help.

Your python is not correct intalled try purge and re-install

I tried reinstalling Python, but then had another issue come up with the Pi, so I formatted the sd card and did a clean install of Pi OS 32-bit. Then went in, and only installed the libraries I needed for my project.

After a complete and total clean install, I still cannot install OpenCV-Python. This time, I tried installing via “Manage Packages” in Thonny on the Pi. It gets to the point of “Building wheel for opencv-python (PEP 517)” and this is where it fails.

I’ve copied the output/error message and posted below. In the full output, there is A LOT of “Installing: /tmp/pip-install-rg0384o8/opencv-python…”, so I just included the last 2 before the error.

  -- Installing: /tmp/pip-install-rg0384o8/opencv-python_43f9f441cce64b5aaf05bbe47f8689ce/_skbuild/linux-aarch64-3.9/cmake-install/share/opencv4/lbpcascades/lbpcascade_profileface.xml
  -- Installing: /tmp/pip-install-rg0384o8/opencv-python_43f9f441cce64b5aaf05bbe47f8689ce/_skbuild/linux-aarch64-3.9/cmake-install/share/opencv4/lbpcascades/lbpcascade_silverware.xml
  Copying files from CMake output
  Traceback (most recent call last):
    File "/tmp/tmpep4jioz9_in_process.py", line 280, in <module>
      main()
    File "/tmp/tmpep4jioz9_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/tmp/tmpep4jioz9_in_process.py", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-ar1ozsrn/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 230, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/tmp/pip-build-env-ar1ozsrn/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-ar1ozsrn/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 267, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/tmp/pip-build-env-ar1ozsrn/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 512, in <module>
      main()
    File "setup.py", line 262, in main
      skbuild.setup(
    File "/tmp/pip-build-env-ar1ozsrn/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 673, in setup
      _classify_installed_files(
    File "setup.py", line 398, in _classify_installed_files_override
      with open('%spython/cv2/config-%s.py'
  FileNotFoundError: [Errno 2] No such file or directory: '_skbuild/linux-aarch64-3.9/cmake-install/python/cv2/config-3.py'
  ----------------------------------------
  ERROR: Failed building wheel for opencv-python
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly
Process returned with code 1

More information as I try to get OpenCV to install. It seems that it is a dependency that is causing the issue.

So the latest round shows:

Python: 3.9.2
Platform: Linux-6.1.21-v8+-aarch64-with-glibc2.31
glibc: glibc 2.31
machine: aarch64
bits: 32
pip: n/a
setuptools: 67.6.1
scikit-build: 0.16.7

And it is an error with CMake. I get the “building wheel for CMake” and then “Finished with error”.

I tried installing CMake by itself, and get the same error.

Here is the output when trying to install OpenCV-Python from the command line using pip:

cwren@raspberrypi:~ $ pip install opencv-python
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting opencv-python
  Using cached opencv-python-4.7.0.72.tar.gz (91.1 MB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  Ă— pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [346 lines of output]
      Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple
      Ignoring numpy: markers 'python_version == "3.6" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.7" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.8" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version <= "3.9" and sys_platform == "darwin" and platform_machine == "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.9" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.10" and platform_system != "Darwin"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.10" and platform_system == "Darwin"' don't match your environment
      Ignoring numpy: markers 'python_version >= "3.11"' don't match your environment
      Collecting setuptools==59.2.0
        Using cached https://www.piwheels.org/simple/setuptools/setuptools-59.2.0-py3-none-any.whl (952 kB)
      Collecting wheel==0.37.0
        Using cached https://www.piwheels.org/simple/wheel/wheel-0.37.0-py2.py3-none-any.whl (35 kB)
      Collecting cmake>=3.1
        Using cached cmake-3.26.3.tar.gz (35 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting pip
        Using cached https://www.piwheels.org/simple/pip/pip-23.0.1-py3-none-any.whl (2.1 MB)
      Collecting scikit-build>=0.13.2
        Using cached https://www.piwheels.org/simple/scikit-build/scikit_build-0.17.0-py3-none-any.whl (81 kB)
      Collecting numpy==1.19.3
        Using cached https://www.piwheels.org/simple/numpy/numpy-1.19.3-cp39-cp39-linux_armv7l.whl (10.5 MB)
      Collecting tomli
        Using cached https://www.piwheels.org/simple/tomli/tomli-2.0.1-py3-none-any.whl (12 kB)
      Collecting packaging
        Using cached https://www.piwheels.org/simple/packaging/packaging-23.0-py3-none-any.whl (42 kB)
      Collecting distro
        Using cached https://www.piwheels.org/simple/distro/distro-1.8.0-py3-none-any.whl (20 kB)
      Building wheels for collected packages: cmake
        Building wheel for cmake (pyproject.toml): started
        Building wheel for cmake (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        Ă— Building wheel for cmake (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [299 lines of output]
      
      
            --------------------------------------------------------------------------------
            -- Trying 'Ninja' generator
            --------------------------------
            ---------------------------
            ----------------------
            -----------------
            ------------
            -------
            --
            Not searching for unused variables given on the command line.
            CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
            -- Configuring incomplete, errors occurred!
            See also "/tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
            --
            -------
            ------------
            -----------------
            ----------------------
            ---------------------------
            --------------------------------
            -- Trying 'Ninja' generator - failure
            --------------------------------------------------------------------------------
      
      
      
            --------------------------------------------------------------------------------
            -- Trying 'Unix Makefiles' generator
            --------------------------------
            ---------------------------
            ----------------------
            -----------------
            ------------
            -------
            --
            Not searching for unused variables given on the command line.
            -- The C compiler identification is GNU 10.2.1
            -- Detecting C compiler ABI info
            -- Detecting C compiler ABI info - done
            -- Check for working C compiler: /usr/bin/cc - skipped
            -- Detecting C compile features
            -- Detecting C compile features - done
            -- The CXX compiler identification is GNU 10.2.1
            -- Detecting CXX compiler ABI info
            -- Detecting CXX compiler ABI info - done
            -- Check for working CXX compiler: /usr/bin/c++ - skipped
            -- Detecting CXX compile features
            -- Detecting CXX compile features - done
            -- Configuring done
            -- Generating done
            -- Build files have been written to: /tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_cmake_test_compile/build
            --
            -------
            ------------
            -----------------
            ----------------------
            ---------------------------
            --------------------------------
            -- Trying 'Unix Makefiles' generator - success
            --------------------------------------------------------------------------------
      
            Configuring Project
              Working directory:
                /tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-build
              Command:
                /usr/bin/cmake /tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159 -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-install/src/cmake/data -DPYTHON_VERSION_STRING:STRING=3.9.2 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-mu42xera/overlay/lib/python3.9/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/usr/bin/python3 -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.9 -DPYTHON_LIBRARY:PATH=/usr/lib/arm-linux-gnueabihf/libpython3.9.so -DPython_EXECUTABLE:PATH=/usr/bin/python3 -DPython_ROOT_DIR:PATH=/usr -DPython_FIND_REGISTRY:STRING=NEVER -DPython_INCLUDE_DIR:PATH=/usr/include/python3.9 -DPython_LIBRARY:PATH=/usr/lib/arm-linux-gnueabihf/libpython3.9.so -DPython3_EXECUTABLE:PATH=/usr/bin/python3 -DPython3_ROOT_DIR:PATH=/usr -DPython3_FIND_REGISTRY:STRING=NEVER -DPython3_INCLUDE_DIR:PATH=/usr/include/python3.9 -DPython3_LIBRARY:PATH=/usr/lib/arm-linux-gnueabihf/libpython3.9.so -DCMAKE_BUILD_TYPE:STRING=Release
      
            -- The CXX compiler identification is GNU 10.2.1
            -- Detecting CXX compiler ABI info
            -- Detecting CXX compiler ABI info - done
            -- Check for working CXX compiler: /usr/bin/c++ - skipped
            -- Detecting CXX compile features
            -- Detecting CXX compile features - done
            -- ***************************************************
            -- Build CMake from source: ON
            -- ***************************************************
            -- SuperBuild - CMakeProject-src-download
            -- SuperBuild - CMakeProject-src-download - URL: https://github.com/Kitware/CMake/releases/download/v3.26.3/cmake-3.26.3.tar.gz
            -- SuperBuild - CMakeProject-src-download - CMakeProject_SOURCE_DIR: /tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/CMake-src
            -- Looking for __GLIBC__
            -- Looking for __GLIBC__ - found
            -- Looking for __GLIBC_MINOR__
            -- Looking for __GLIBC_MINOR__ - found
            -- SuperBuild -   CMakeProject-build
            -- SuperBuild -   CMakeProject-build - CMakeProject_BINARY_DIR: /tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-build/CMakeProject-build
            -- SuperBuild -   CMakePythonDistributions
            -- Configuring done
            -- Generating done
            CMake Warning:
              Manually-specified variables were not used by the project:
      
                PYTHON_EXECUTABLE
                PYTHON_INCLUDE_DIR
                PYTHON_LIBRARY
                PYTHON_VERSION_STRING
                Python3_EXECUTABLE
                Python3_FIND_REGISTRY
                Python3_INCLUDE_DIR
                Python3_LIBRARY
                Python3_ROOT_DIR
                Python_EXECUTABLE
                Python_FIND_REGISTRY
                Python_INCLUDE_DIR
                Python_LIBRARY
                Python_ROOT_DIR
                SKBUILD
      
      
            -- Build files have been written to: /tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-build
            Scanning dependencies of target CMakeProject-src-download
            [  3%] Creating directories for 'CMakeProject-src-download'
            [  7%] Performing download step (download, verify and extract) for 'CMakeProject-src-download'
            -- Downloading...
               dst='/tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-build/cmake-3.26.3.tar.gz'
               timeout='none'
            -- Using src='https://github.com/Kitware/CMake/releases/download/v3.26.3/cmake-3.26.3.tar.gz'
            -- [download 0% complete]
            -- [download 1% complete]
            -- [download 2% complete]
            -- [download 3% complete]
            -- [download 4% complete]
            -- [download 5% complete]
            -- [download 6% complete]
            -- [download 8% complete]
            -- [download 11% complete]
            -- [download 12% complete]
            -- [download 18% complete]
            -- [download 31% complete]
            -- [download 42% complete]
            -- [download 53% complete]
            -- [download 66% complete]
            -- [download 78% complete]
            -- [download 89% complete]
            -- [download 100% complete]
            -- verifying file...
                   file='/tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-build/cmake-3.26.3.tar.gz'
            -- Downloading... done
            -- extracting...
                 src='/tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-build/cmake-3.26.3.tar.gz'
                 dst='/tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/CMake-src'
            -- extracting... [tar xfz]
            -- extracting... [analysis]
            -- extracting... [rename]
            -- extracting... [clean up]
            -- extracting... done
            [ 11%] No update step for 'CMakeProject-src-download'
            [ 15%] No patch step for 'CMakeProject-src-download'
            [ 19%] No configure step for 'CMakeProject-src-download'
            [ 23%] No build step for 'CMakeProject-src-download'
            [ 26%] No install step for 'CMakeProject-src-download'
            [ 30%] Completed 'CMakeProject-src-download'
            [ 30%] Built target CMakeProject-src-download
            Scanning dependencies of target CMakeProject-build
            [ 34%] Creating directories for 'CMakeProject-build'
            [ 38%] No download step for 'CMakeProject-build'
            [ 42%] No update step for 'CMakeProject-build'
            [ 46%] No patch step for 'CMakeProject-build'
            [ 50%] Performing configure step for 'CMakeProject-build'
            loading initial cache file /tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-build/initial-cache.txt
            loading initial cache file /tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-build/CMakeProject-build-prefix/tmp/CMakeProject-build-cache-Release.cmake
            -- The C compiler identification is GNU 10.2.1
            -- The CXX compiler identification is GNU 10.2.1
            -- Detecting C compiler ABI info
            -- Detecting C compiler ABI info - done
            -- Check for working C compiler: /usr/bin/cc - skipped
            -- Detecting C compile features
            -- Detecting C compile features - done
            -- Detecting CXX compiler ABI info
            -- Detecting CXX compiler ABI info - done
            -- Check for working CXX compiler: /usr/bin/c++ - skipped
            -- Detecting CXX compile features
            -- Detecting CXX compile features - done
            -- Checking if compiler supports C11 _Thread_local
            -- Checking if compiler supports C11 _Thread_local - yes
            -- Checking if compiler supports needed C++17 constructs
            -- Checking if compiler supports needed C++17 constructs - yes
            -- Checking if compiler supports C++ make_unique
            -- Checking if compiler supports C++ make_unique - yes
            -- Checking if compiler supports C++ filesystem
            -- Checking if compiler supports C++ filesystem - yes
            -- Looking for unsetenv
            -- Looking for unsetenv - found
            -- Looking for environ
            -- Looking for environ - not found
            -- Looking for pthread.h
            -- Looking for pthread.h - found
            -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
            -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
            -- Looking for pthread_create in pthreads
            -- Looking for pthread_create in pthreads - not found
            -- Looking for pthread_create in pthread
            -- Looking for pthread_create in pthread - found
            -- Found Threads: TRUE
            -- Checking whether wstring is available
            -- Checking whether wstring is available - yes
            -- Checking whether C compiler has ptrdiff_t in stddef.h
            -- Checking whether C compiler has ptrdiff_t in stddef.h - yes
            -- Checking whether C compiler has ssize_t in unistd.h
            -- Checking whether C compiler has ssize_t in unistd.h - yes
            -- Checking whether C compiler has clock_gettime
            -- Checking whether C compiler has clock_gettime - yes
            -- Checking whether CXX compiler has setenv
            -- Checking whether CXX compiler has setenv - yes
            -- Checking whether CXX compiler has unsetenv
            -- Checking whether CXX compiler has unsetenv - yes
            -- Checking whether CXX compiler has environ in stdlib.h
            -- Checking whether CXX compiler has environ in stdlib.h - no
            -- Checking whether CXX compiler has utimes
            -- Checking whether CXX compiler has utimes - yes
            -- Checking whether CXX compiler has utimensat
            -- Checking whether CXX compiler has utimensat - yes
            -- Checking whether CXX compiler struct stat has st_mtim member
            -- Checking whether CXX compiler struct stat has st_mtim member - yes
            -- Checking whether CXX compiler struct stat has st_mtimespec member
            -- Checking whether CXX compiler struct stat has st_mtimespec member - no
            -- Looking for include files sys/types.h, ifaddrs.h
            -- Looking for include files sys/types.h, ifaddrs.h - found
            -- Checking whether CXX compiler has rlimit64
            -- Checking whether CXX compiler has rlimit64 - yes
            -- Looking for C++ include execinfo.h
            -- Looking for C++ include execinfo.h - found
            -- Checking whether backtrace works with this C++ compiler
            -- Checking whether backtrace works with this C++ compiler - yes
            -- Looking for C++ include dlfcn.h
            -- Looking for C++ include dlfcn.h - found
            -- Checking whether dladdr works with this C++ compiler
            -- Checking whether dladdr works with this C++ compiler - yes
            -- Looking for C++ include cxxabi.h
            -- Looking for C++ include cxxabi.h - found
            -- Checking whether cxxabi works with this C++ compiler
            -- Checking whether cxxabi works with this C++ compiler - yes
            -- Checking whether CXX compiler has getloadavg
            -- Checking whether CXX compiler has getloadavg - yes
            -- Checking whether <ext/stdio_filebuf.h> is available
            -- Checking whether <ext/stdio_filebuf.h> is available - yes
            -- Performing Test HAVE_SOCKADDR_IN6_SIN6_ADDR
            -- Performing Test HAVE_SOCKADDR_IN6_SIN6_ADDR - Success
            -- Performing Test HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
            -- Performing Test HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID - Success
            -- Looking for connect in socket;
            -- Looking for connect in socket; - not found
            -- Looking for gethostname
            -- Looking for gethostname - found
            -- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR)
            CMake Error at Utilities/cmcurl/CMakeLists.txt:608 (message):
              Could not find OpenSSL.  Install an OpenSSL development package or
              configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL.
      
      
            -- Configuring incomplete, errors occurred!
            See also "/tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-build/CMakeProject-build/CMakeFiles/CMakeOutput.log".
            See also "/tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-3.9/cmake-build/CMakeProject-build/CMakeFiles/CMakeError.log".
            gmake[2]: *** [CMakeFiles/CMakeProject-build.dir/build.make:129: CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-configure] Error 1
            gmake[1]: *** [CMakeFiles/Makefile2:127: CMakeFiles/CMakeProject-build.dir/all] Error 2
            gmake: *** [Makefile:149: all] Error 2
            Traceback (most recent call last):
              File "/tmp/pip-build-env-mu42xera/overlay/lib/python3.9/site-packages/skbuild/setuptools_wrap.py", line 670, in setup
                cmkr.make(make_args, install_target=cmake_install_target, env=env)
              File "/tmp/pip-build-env-mu42xera/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 693, in make
                self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
              File "/tmp/pip-build-env-mu42xera/overlay/lib/python3.9/site-packages/skbuild/cmaker.py", line 738, in make_impl
                raise SKBuildError(msg)
      
      
                =============================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.2
                platform: Linux-6.1.21-v8+-aarch64-with-glibc2.31
                glibc: glibc 2.31
                machine: aarch64
                bits: 32
                pip: n/a
                setuptools: 67.6.1
                scikit-build: 0.17.0
                PEP517_BUILD_BACKEND=setuptools.build_meta
                =============================DEBUG ASSISTANCE=============================
      
            An error occurred while building with CMake.
              Command:
                /usr/bin/cmake --build . --target install --config Release --
              Install target:
                install
              Source directory:
                /tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159
              Working directory:
                /tmp/pip-install-f07bn_9r/cmake_5cec1d022fae45cdbe8510890bbbc159/_skbuild/linux-aarch64-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.
cwren@raspberrypi:~ $ 

When I run “cmake version”, it returns 3.22.6

please reconsider this.
now pip cant find anything prebuilt for 32bit (they might have given up long time ago about this). and it tries to get cmake to build numpy from scratch …

rule of thumb: if pip starts building wheels, you’re WAY OFF the trodden path …

again, make your life easy, &try to find a proper 64bit os for your pi, that has better support from pip

oh noes ! no, no, no !
please avoid thonny (or any other silly noob ide), which install it’s own python. now you got 2 !

So a lot in this post, the TLDR; version:

  1. I am going to try a 64bit OS, thank you

  2. Is there a better ide or way to run the *.py file other than Thonny? I just used it because it came in the OS install bundle

Now for the more detailed version.

Ah. I forget why I started with 32bit. I think it had to do with PiCamera. But since I am running Bullseye OS and PiCamera used the old camera commands while PiCamera2 uses the new licbam setup. Luckily I have 2 units that are identical that I am prototyping with, so I will format and make one a 64bit and leave one as a 32bit and see the difference. That may be all of it. Thank you!

Thonny was a default install on the OS image. Is there a better way? I use Sublime Text Editor 3 to write everything on my desktop and then just transfer the *.py file to the Pi.

But having 2 installs kind of makes sense. When I do a clean OS install, I get Python 3.9.2. I tried to upgrade from 3.9.2 to 3.11.3 and PIP just seems to fight me the whole time after the upgrade. I followed the instructions here: Update Python and I get the new install, and have the option to use 3.11.3 in Thonny, but when I use the terminal command line and run:

pip install {module}

to install a new module, it always defaults to installing into the 3.9.2 installation and not the 3.11.3 instalaltion. So then I have to go and copy the “site-dist” folder from the 3.9.2 install to the 3.11.3 install folder. That “seeeeeeeems” to work, but I know it is not ideal.

So, using a 64bit version of PiOS did the trick. I have now been able to install OpenCV. Thank you.

1 Like