opencv / opencv-python

Automated CI toolchain to produce precompiled opencv-python, opencv-python-headless, opencv-contrib-python and opencv-contrib-python-headless packages.
https://pypi.org/project/opencv-python/
MIT License
4.43k stars 835 forks source link

"pip install opencv-python" fails to find opencv-python #102

Closed jopotochny closed 6 years ago

jopotochny commented 6 years ago

Expected behaviour

"pip install opencv-python" should install opencv-python, as it has on my Windows machine.

Actual behaviour

I am sshing into a CentOS machine and "pip install opencv-python" does not find it, instead I get the message: Collecting opencv-python Could not find a version that satisfies the requirement opencv-python (from versions: ) No matching distribution found for opencv-python

My pip and wheel installations are all up to date, which seemed to be the issue for other people with the same problem. The manylinux wheels do not work for me either, I get a message back saying:

opencv_python-3.4.1.15-cp36-cp36m-manylinux1_x86_64.whl is not a supported wheel on this platform.

I have used manylinux wheels for other things in the past and they have worked, so I am fairly confident that I should be able to use it. Is opencv known to not be compatible with CentOS, or am I missing something?

Steps to reproduce

"pip install opencv-python" on a CentOS machine.

skvark commented 6 years ago

Can you install any other wheels like numpy? To my knowledge, pip checks only the wheel filename tags and if they not match your system and Python it will throw that error. This seems like the same issue as in here: https://github.com/skvark/opencv-python/issues/83#issuecomment-381212958 (have a look at the latest comments).

jopotochny commented 6 years ago

[('cp36', 'cp36m', 'linux_x86_64'), ('cp36', 'abi3', 'linux_x86_64'), ('cp36', 'none', 'linux_x86_64'), ('cp35', 'abi3', 'linux_x86_64'), ('cp34', 'abi3', 'linux_x86_64'), ('cp33', 'abi3', 'linux_x86_64'), ('cp32', 'abi3', 'linux_x86_64'), ('py3', 'none', 'linux_x86_64'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('py36', 'none', 'any'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')] is what I get by checking the supported tags. I thought manylinux would work because I thought I had used them before, but I just checked the PyTorch wheel I had used and it is actually linux_x86_64, so my mistake. I guess CentOS is not compatible with manylinux. If I cannot use the manylinux wheels, and I cannot use pip as it cannot find opencv-python, am I just not able to use opencv-python? I don't think there was a linux_x86_64 wheel available.

jopotochny commented 6 years ago

Upon further research it seems like CentOS should be compatible with manylinux as the criteria for making a wheel manylinux compatible seems to be building it on CentOS 5. I found a workaround that I will try, but I am really not sure why manylinux wheels would not build on CentOS 7.

skvark commented 6 years ago

Yes, CentOS is compatible with manylinux wheels. There's something odd going on with your Python installation. Are you sure you are using correct pip to install the wheels? On some systems Python 3 pip is called pip3. Also, if you try to install manually for example this numpy wheel https://files.pythonhosted.org/packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl, does it have the same issue?

jopotochny commented 6 years ago

I am sure I am using the correct pip, the pip I am using corresponds to the virtualenv I am using. I tried pip3 and it gives me the same error : pip3 install https://files.pythonhosted.org/packages/7c/78/bc95e29057e80d1da71912426113e85f20752b1031193f51750322354937/opencv_python-3.4.1.15-cp36-cp36m-manylinux1_x86_64.whl opencv_python-3.4.1.15-cp36-cp36m-manylinux1_x86_64.whl is not a supported wheel on this platform. . Same for the numpy wheel, I get the same issue: pip install https://files.pythonhosted.org/packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl is not a supported wheel on this platform. .

skvark commented 6 years ago

The issue seems to be the same with all wheel packages which means that your Python installation is not compatible with manylinux1 wheels. I'm afraid this issue is not really related to opencv-python.

jopotochny commented 6 years ago

Fair enough. Thank you for your time, I will try to investigate as to why my python distribution is not compatible with manylinux wheels.

udbraumann commented 5 years ago

What about cygwin installations of python (2.7 or 3.6)? It appears as if there is no way to install opencv-python?

%pip2.7 install opencv-python Collecting opencv-python Could not find a version that satisfies the requirement opencv-python (from versions: ) No matching distribution found for opencv-python

%pip3.6 install opencv-python Collecting opencv-python Could not find a version that satisfies the requirement opencv-python (from versions: ) No matching distribution found for opencv-python

waveform80 commented 5 years ago

@udbraumann I doubt the opencv-python wheels are compatible with Cygwin, which probably isn't compatible with the "manylinux" spec, and also isn't compatible with wheels built for regular Windows Python. I suspect you'll have to build OpenCV manually for Cygwin.

udbraumann commented 5 years ago

@waveform80 I need to say that OpenCV 3.4.1 itself is being shipped with Cygwin. opencv-python however seems to be not just an interface to OpenCV, but rather some combination of installation and interface. Could you please give some hints how to build opencv-python "on foot"?

waveform80 commented 5 years ago

Bear in mind that this opencv-python repository has little to do with the OpenCV project itself; it exists to build and provide the pre-compiled wheels of OpenCV (in a variety of configurations) to the PyPI archive for use by compatible platforms (my assumption above is that Cygwin is not a compatible platform).

You're probably best off looking at instructions for building the OpenCV library itself (which should include the Python 2/3 bindings), bearing in mind that Cygwin is likely to be closer to a Linux build than a Windows build. Hence the OpenCV build instructions for Linux may help (although they assume an Ubuntu style package manager; you'll need to translate those bits as necessary for Cygwin). Alternatively there appear to be some Cygwin specific instructions from a quick Google, though they don't appear to include the necessary options to build the Python bindings (might be worth combining those instructions with some bits from the official guide).

If you run into issues building OpenCV itself, these are best directed to the OpenCV repository itself rather than here.

yavuz1998 commented 4 years ago

What about cygwin installations of python (2.7 or 3.6)? It appears as if there is no way to install opencv-python?

%pip2.7 install opencv-python Collecting opencv-python Could not find a version that satisfies the requirement opencv-python (from versions: ) No matching distribution found for opencv-python

%pip3.6 install opencv-python Collecting opencv-python Could not find a version that satisfies the requirement opencv-python (from versions: ) No matching distribution found for opencv-python

did you solve the problem?

udbraumann commented 4 years ago

unfortunately not, but admittedly I did not try too long, as I felt I am the only one missing opencv-python for python.

snowinmars commented 4 years ago

unfortunately not, but admittedly I did not try too long, as I felt I am the only one missing opencv-python for python.

You're not alone. I'm trying to start AnimeGAN and I'm struggling with the opencv python issue.