Opencv on raspi zero w


i am trying to opencv in a raspi zero w project. but have had no luck getting cv2 to import.
i get a modulenotfounderror: no module named ‘cv2’
and yes i have spent many days searching through forums and updating installing and importing dependencies and reinstallling opencv and much more. does any one know a full proof guide to get opencv working?

1 Like

Hi Wes,


What kind of models are you looking to run? Before you sink all of this effort into getting it working it might be better to fact check with someone your goals for the project.

Other hardware might be better suited for the application

thanks for the reply @Liam120347,

no models yet (althought that is project number 2 on the list), right now i am trying to make a “photobooth” application with the HQ camera. i have all the hardware sorted already and have design the GUI using tkinter but the last thing is to create a label using tkinter to run the camera feed in and then when a button is pressed on the GUI it will email a snaphot (picture) of that livefeed to the email address. Unfortunetly all examples online to do this use opencv and i have not been able to get it to work.

1 Like

Hi @wes261965 - opencv is installed separately. what steps have you taken to install opencv? have you followed any online guides for installing opencv?

1 Like

@Michael i could name all the steps but i would be here for a while.

really what i am asking is if anyone has had this problem and has a solution that they followed.

from what i can tell updating does not fix it, wiping the os and starting again doesnt fix it, i tried installing a list of dozen dependencies from various forums and updated after this.

i know there is a solution but i just cannot find one.

@Michael Set up OpenCV on Raspberry Pi 4 2023 | Little Bird Australia
this is the one i am trying right now but i keep getting
package libpng12-dev is not available, but is reffered to bya nother package. this may mean that the package is missing, has been obsolete, or is only available from another source.

E: Package ;libpng12-dev’ has no installation candidate

? i amguessing this means it is obsolete? i am also guessing the other depndencies this tutorial is asking me to install are going to give me the same error

Hi Wes,

IIRC the Zero runs a different architecture than the 4, so that guide is likely not to work. I’d try with a Pi 4 next.

FYI, I tried image recognition on a zero once, it took minutes to process a single frame. It simply does not have the grunt needed for this.