Home > Enterprise >  No module named 'cv2' issue with opencv and contrib modules
No module named 'cv2' issue with opencv and contrib modules

Time:08-19

No matter what I install, it's either opencv-python, opencv-contrib-python or both at the same time, I keep getting the "No module named 'cv2'" error. I couldn't find an answer here. Some say that only opencv-python works, others say opencv-contrib-python works. I tried everything but nothing seems to work. I'm trying to use the aruco function and I know it belongs to the contrib module. Any tip? Thanks

CodePudding user response:

Did you try to restart your code editor? I often need to close the file or whole VScoode and reopen for it to see the library I just installed.

Another problem could be that you're installing cv2 to a python verse that youre not using on your code editor.. If youre using python2.9 on your code editor but you install cv2 on your terminal with "pip3.10 install opencv-python" command, your code editor wont find it

CodePudding user response:

I would recommend using conda and creating a new enviroment. Then try sudo pip3 install opencv-python if youre using python3 or you can try sudo pip install opencv-python if you're using python2. This worked for me.

Another tip is to always check that you have the newest version of pip pip install --upgrade pip

  • Related