# Error when installing opencv with Python Interactor on mac

**URL:** <https://discourse.slicer.org/t/error-when-installing-opencv-with-python-interactor-on-mac/15544>\
**Category:** Development\
**Tags:** opencv\
**Created:** [January 15, 2021, 8:54pm UTC](https://discourse.slicer.org/t/error-when-installing-opencv-with-python-interactor-on-mac/15544 "2021-01-15T20:54:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HodaGH](https://avatars.discourse-cdn.com/v4/letter/h/858c86/32.png) [@HodaGH](https://discourse.slicer.org/u/HodaGH)\
**Post date:** [January 15, 2021, 8:54pm UTC](https://discourse.slicer.org/t/error-when-installing-opencv-with-python-interactor-on-mac/15544/1 "2021-01-15T20:54:50Z")

</div>

Hi everyone,

I have MacOS 10.14. I’m trying to install opencv in the python interactor by this code:

from slicer.util import pip\_install  
pip\_install(“opencv”)

I get this error:

ERROR: Could not find a version that satisfies the requirement opencv (from versions: none)  
ERROR: No matching distribution found for opencv  
WARNING: You are using pip version 20.1.1; however, version 20.3.3 is available.  
You should consider upgrading via the ‘/Applications/Slicer.app/Contents/bin/./python-real -m pip install --upgrade pip’ command.  
Traceback (most recent call last):  
File “”, line 1, in   
File “/Applications/Slicer.app/Contents/bin/Python/slicer/util.py”, line 2569, in pip\_install  
\_executePythonModule(‘pip’, args)  
File “/Applications/Slicer.app/Contents/bin/Python/slicer/util.py”, line 2545, in \_executePythonModule  
logProcessOutput(proc)  
File “/Applications/Slicer.app/Contents/bin/Python/slicer/util.py”, line 2517, in logProcessOutput  
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)  
subprocess.CalledProcessError: Command ‘[’/Applications/Slicer.app/Contents/bin/…/bin/PythonSlicer’, ‘-m’, ‘pip’, ‘install’, ‘opencv’]’ returned non-zero exit status 1.

Also regarding the Warning that I get for the update for pip when I open the python real, it is not editable to be able to put this code:

/Applications/Slicer.app/Contents/bin/./python-real -m pip install --upgrade pip

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![adamrankin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/adamrankin/32/155_2.png) [@adamrankin](https://discourse.slicer.org/u/adamrankin)\
**Post date:** [January 15, 2021, 9:02pm UTC](https://discourse.slicer.org/t/error-when-installing-opencv-with-python-interactor-on-mac/15544/2 "2021-01-15T21:02:18Z")

</div>

This doesn’t exactly answer your question, but you could install the SlicerOpenCV extension, which will install opencv and python bindings.

---

<div class="post-metadata">

**Author:** ![HodaGH](https://avatars.discourse-cdn.com/v4/letter/h/858c86/32.png) [@HodaGH](https://discourse.slicer.org/u/HodaGH)\
**Post date:** [January 15, 2021, 9:42pm UTC](https://discourse.slicer.org/t/error-when-installing-opencv-with-python-interactor-on-mac/15544/3 "2021-01-15T21:42:11Z")

</div>

I searched for SlicerOpenCV in the slicer extensions but I couldn’t find it.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [January 15, 2021, 10:08pm UTC](https://discourse.slicer.org/t/error-when-installing-opencv-with-python-interactor-on-mac/15544/4 "2021-01-15T22:08:01Z")

</div>

I believe the correct name to use to pip install OpenCV is “opencv-python”. So in Slicer it would be `slicer.util.pip_install("opencv-python")` instead of `slicer.util.pip_install("opencv")` as you tried.

See [opencv-python · PyPI](https://pypi.org/project/opencv-python/)
