I'm attempting to install pyopencv. I have installed both Python and OpenCV through Brew. A quick which python/pip
shows that I'm using the version of Python installed through Brew as the default. I have already installed numpy through pip. However, when I try to run pip install pyopencv
I get back:
Downloading/unpacking pyopencv
Could not find a version that satisfies the requirement pyopencv (from versions: 2.0.wr1.0.1-demo, 2.0.wr1.0.1, 2.0.wr1.1.0, 2.1.0.wr1.0.0, 2.1.0.wr1.0.1, 2.1.0.wr1.0.2, 2.1.0.wr1.1.0, 2.1.0.wr1.2.0, 2.1.0.wr1.2.0-demo, 2.1.0.wr1.2.0)
Cleaning up...
No distributions matching the version for pyopencv
Storing complete log in /Users/golmschenk/.pip/pip.log
A semi-related question had the same error, but under a different circumstance. The problem here appears to have been with the virtual-environment and they were using the pre-installed version of Python rather than the Brew version.
Any suggestions as to how I might fix this? Thank you much!
Update:
According to this question/solution when a Could not find a version that satisfies the requirement
error arises, it's because
pip will only install stable versions as specified by PEP426 by default. If a version cannot be parsed as a compliant PEP426 version then it is assumed to be a pre-release.
This can be worked around using pip install --pre
to install pre-release packages. However, upon doing this (or attempting to install pyopencv using easy_install) I run into the error: ImportError: cannot import name Library
.
Update 2:
Further research into this new error presented this question/solution. Here the ImportError: cannot import name Library
comes from the new version of setuptools having the Library is inside of extension.py. Such that pyopencv should import Library as setuptools.extension.Library and not setuptools.Library. A temporary solution to this would be to manually change this. However, I'd prefer a more appropriate solution if one exists over manually editing 3rd-party packages. Any suggestions? Thanks!
Update 3:
If OpenCV and Python were install correctly through Brew it appears you can use OpenCV in Python simply by importing the cv2 module (as was discovered in the comments). So that solves my problem. However, for others who may actually need pyopencv for something I'll leave this question open.