Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'cv2' #22157

Open
pedrombmachado opened this issue Jun 24, 2022 · 5 comments
Open

ModuleNotFoundError: No module named 'cv2' #22157

pedrombmachado opened this issue Jun 24, 2022 · 5 comments

Comments

@pedrombmachado
Copy link

pedrombmachado commented Jun 24, 2022

System information (version)
  • OpenCV => 4.6.0
  • Operating System / Platform => Ubuntu 20.04
  • Compiler => gcc-9
Detailed description

I was getting the error ModuleNotFoundError: No module named 'cv2' after running make install.

The problem

The PYTHON3_PACKAGES_PATH was being set to /usr/local/lib/python3.8/site-packages
This started to happen in version 4.6.0. I suspect that the cmake find is not picking the correct path.

Temporary fix

set cmake to install in the correct path cmake -D PYTHON3_PACKAGES_PATH=/usr/local/lib/python3.8/dist-packages ..

@chetubetcha
Copy link

chetubetcha commented Jun 24, 2022

I am having the same problem. I KINDA fixed it by using auto-py-to-exe and I selected a bunch of files in the cv2 folder as well as the cv2 folder itself, although that may be redundant. No it actually imports cv2, but I get this error - ImportError: numpy.core.multiarray failed to import. SO I'm on to the next one now

@pedrombmachado
Copy link
Author

@chetubetcha I am glad to know that you have also found a fix.

@bunny254
Copy link

ModuleNotFoundError: No module named 'cv2'
*OS : Windows 11
*Python Version : Python 3.7.0
*Pyenv Version: 3.1.1

Anyone with a hint on how to get rid of this error?

@isaacurban141
Copy link

ModuleNotFoundError: No module named 'cv2' *OS : Windows 11 *Python Version : Python 3.7.0 *Pyenv Version: 3.1.1

Anyone with a hint on how to get rid of this error?

It's been a while, but I think I copied all the CV modules from my venv to my build directory and it worked

@bunny254
Copy link

I have serious issues with using pyenv where if I load a library I'm not sure where exactly it gets installed ending up with the module not found issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants