Search code examples
pythonopencvpipraspberry-pipython-wheel

OpenCV Raspberry Pi Error Could not build wheels


I'm attempting to install OpenCV on my Raspberry Pi 3B+, and I'm encountering an issue during the installation using pip install. I consistently receive the following error message:

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

Is there an updated method for installing OpenCV (cv2) on the Raspberry Pi, or is there a pre-installed system image available that includes OpenCV?

Thank you in advance.


Solution

  • Based on the comments, it actually worked to install cv2. The following guide worked for me:

    wget https://github.com/prepkg/opencv-raspberrypi/releases/latest/download/opencv.deb

    sudo apt install -y ./opencv.deb

    opencv_version --> to check the version

    rm -rf opencv.deb --> delelte unsessesarry file

    Then, I checked if I can import cv2 in a Python file, and it worked out. Thank you.

    Here is the link to the original post: https://lindevs.com/install-precompiled-opencv-on-raspberry-pi/#write-comment