0

I would like to use opencv-python and opencv-contrib-python versions in 3.3 or below on Python 3.7. The issue is that I can't seem to get them on pip3. I need it to be pip3 and Python 3.7 because it's to run on Google Cloud Functions.

If I run $ pip3 install opencv-contrib-python== to get the versions I get:

versions: 3.4.2.16, 3.4.2.17, 3.4.3.18, 3.4.4.19, 3.4.5.20, 4.0.0.21, 4.0.1.24, 4.1.0.25

and from pip3 install opencv-python==

versions: 3.4.2.16, 3.4.2.17, 3.4.3.18, 3.4.4.19, 3.4.5.20, 4.0.0.21, 4.0.1.24, 4.1.0.25

How can I get older versions like 3.3.1.11 which are available in pip2?

Of course deploying trying to get the old version on GCloud gives me

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`pip_download_wheels` had stderr output:\n  Could not find a version that satisfies the requirement opencv-python==3.2.0.7 (from -r requirements.txt (line 2)) (from versions: 3.4.2.17, 3.4.3.18, 3.4.4.19, 3.4.5.20, 4.0.0.21, 4.0.1.23, 4.0.1.24, 4.1.0.25)\nNo matching distribution found for opencv-python==3.2.0.7 (from -r requirements.txt (line 2))\n\nerror: `pip_download_wheels` returned code: 1", "errorType": "InternalError", "errorId": "91F6A3AC"}}
Anters Bear
  • 1,816
  • 1
  • 15
  • 41
  • 2
    Please see the bottom of https://pypi.org/project/opencv-python/3.3.1.11/ , opencv-python 3.3.1.11 or below doesn't support python 3.7. – Yang HG Apr 22 '19 at 07:32
  • @YangHG Thanks! Important hint there. Can I recompile it or something for it to work with 3.7? – Anters Bear Apr 22 '19 at 07:34
  • Is there a particular reason for using this specific version of OpenCV? If you're working on a legacy code, how about considering upgrade the library? (just want to know more about your scenario mate) – Luan Nguyen Apr 22 '19 at 07:40
  • @LuanNguyen valid question, I need `xfeatures2d` which is only in the prior versions of the contrib library :) – Anters Bear Apr 22 '19 at 07:41
  • I didn't do that before, you can try to find its source code and recompile it.. To be honest, It's not easy to please, especially opencv has a lot of C code. I guess you need to solve a lot of compatible problems. – Yang HG Apr 22 '19 at 07:45
  • Instead of solving the compatibility problem between opencv and python 3.7, why not solve the compatibility problem between your code and opencv? – Yang HG Apr 22 '19 at 07:46
  • @YangHG I think unfortunately I will have to do the first thing you suggested and solve the issues on OpenCV side. Because the newer versions are missing the functions I need entirely :( – Anters Bear Apr 22 '19 at 07:51
  • Ummmmm... How about find `xfeatures2d` source codes in older version of opencv, then reimplement it by yourself... It's better than recompile a whole opencv package. – Yang HG Apr 22 '19 at 07:54
  • Please see this question https://stackoverflow.com/questions/52305578/sift-cv2-xfeatures2d-sift-create-not-working-even-though-have-contrib-instal , if you only have this problem, it can help you. – Yang HG Apr 22 '19 at 07:57
  • @YangHG will for sure try that thank you :). I also tried some of the same algorithms implemented in Python from github but they run 10x slow. The one at the link only lets me get 3.4.2.17 for some reason and it doesn't have xfeatures2d. – Anters Bear Apr 22 '19 at 08:01
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/192205/discussion-between-yang-hg-and-anters-bear). – Yang HG Apr 22 '19 at 08:06

0 Answers0