Import Error: aruco from cv2

Curious why I get this problem.

On a normal code compiler, importing aruco works. But if I try to run a python debugger, it sends a warning about the error in importing aruco. I’m tried to implement the program at startup (raspberry pi) but it doesn’t work because of the import error. It did work at a normal run in the compiler?

Here’s the copy of my code:

import cv2
from cv2 import aruco 
import numpy as np

corners, ids, rejected = aruco.detectMarkers(gray, self.arucoDict, parameters = self.arucoParam) 

Python debug warning

Exception has occurred: ImportError
cannot import name 'aruco' from 'cv2'

Program Error when we tried to implement the program at startup

Import Error: cannot import name 'aruco' from 'cv2'

Code can also show that it can detect markers.
Am I missing something here?

please show that . . .

1 Like

updated the post. thanks

please, no screenshots of code or errors here, replace with text, thank you.

1 Like

Oh sorry, updated the post again. Thank you!

1 Like

aruco is a “contrib” module. you need to remove all opencv packages and install exactly one, which must include contrib modules.

please search for issues/errors before asking. this is being asked multiple times a month.

1 Like