Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why can't I install OpenCV using pip on my Mac 12.0.1 (Monterey)?

When I tried install OpenCV using python pip, it showed this:

Remainder of file ignored
Requirement already satisfied: pip in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (20.3.4)
Collecting pip
  Using cached pip-21.3.1-py3-********* (1.7 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.3.4
    Uninstalling pip-20.3.4:
      Successfully uninstalled pip-20.3.4
Successfully installed pip-21.3.1

*Mine*-MacBook-Air ~ % pip install cv2
Error processing line 1 of /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/********:
Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site.py", line 169, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<frozen **********bootstrap>", line 562, in module_from_spec
  AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored

Error processing line 1 of /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/*******************:

Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site.py", line 169, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "<********.bootsrap>", line 562, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'

Remainder of file ignored

ERROR: Could not find a version that satisfies the requirement cv2 (from versions: none)
ERROR: No matching distribution found for cv2

I don’t know why even if I try reinstalling python, nothing happens!

I am on Macbook Air ‘version is given above’ and even with python 10.1 (latest current version) nothing happens!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

My pip version is also the latest one (you can find it in the above command).

Moreover this problem doesn’t happen with some packages, it only happens with a few packages like open cv (cv2). Also, the command used by me to install it was ” PIP install cv2 ”. And please don’t recommend me to upgrade my python version, cause I have tried it already and it showed the same thing!

>Solution :

How and where are you trying to install on your mac?

Try pip install opencv-python instead of pip install cv2

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading