52

I am struggling with Jetson TX2 board (aarch64).

I need to install python wrapper for OpenCV.

I can do:

$ sudo apt-get install python-opencv

But I cannot do:

$ sudo pip install opencv-python

Is this because there is no proper wheel file in http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv?

Is there a way to install opencv-python through pip?

ghchoi
  • 4,812
  • 4
  • 30
  • 53
  • Did the solution below work out for you? –  Sep 06 '17 at 13:05
  • 1
    @traducerad pip does not provide opencv-python for aarch64... – ghchoi Sep 06 '17 at 14:10
  • How did you solve it then? –  Sep 06 '17 at 14:22
  • put differently: How can you `import cv2` on the Jetson TX2? –  Sep 06 '17 at 14:25
  • 1
    @traducerad Easy. Compile OpenCV from its source. then just `sudo apt-get install python-opencv`. – ghchoi Sep 07 '17 at 02:45
  • I am affraid that this solution may give linking issues at one moment or another. Here is what solved it for me: https://devtalk.nvidia.com/default/topic/1023652/jetson-tx2/how-can-i-run-python-for-opencv-on-my-jetson-/post/5207956/#5207956 :) –  Sep 07 '17 at 11:22

13 Answers13

58

We were getting the same error.For us, it solved by upgrading pip version (also discussed in FAQ of OpenCV GitHub). Earlier we had pip-7.1.0, post upgrading it to "pip-9.0.2", it successfully installed.

pip install --upgrade pip
pip install opencv-python
double-beep
  • 5,031
  • 17
  • 33
  • 41
Neo
  • 5,070
  • 10
  • 46
  • 65
20

pip doesn't use http://www.lfd.uci.edu/~gohlke/pythonlibs/, it downloads packages from PyPI.

The problem is that you have an unusual architecture; pip cannot find a package for it and there is no source code package.

Unfortunately I think you're on your own. You have to download source code from https://github.com/skvark/opencv-python, install compiler and necessary libraries and compile OpenCV yourself.

phd
  • 82,685
  • 13
  • 120
  • 165
18

Use this and it will work:

pip install --upgrade pip
pip install opencv-python
Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Prateek Saini
  • 346
  • 3
  • 8
10

Another problem can be that the python version you are using is not yet supported by opencv-python.

E.g. as of right now there is no opencv-python for python 3.8. You would need to downgrade your python to 3.7.5 for now.

Jodo
  • 4,515
  • 6
  • 38
  • 50
  • This was my issue. I had to downgrade. – Paul Nov 13 '19 at 22:06
  • Same for me: python 3.8.9 did not work (compatibility pb or a pb on my install?), whereas I could install opencv on python 3.7 or 3.10 (on conda virtual envs). – PJ127 Aug 24 '22 at 07:15
8

It happened with me on Windows, pip was not able to install opencv-python==3.4.0.12.

Later found out that it was due to the Python version, Python 3.7 has some issue with not getting linked to https://github.com/skvark/opencv-python.

Downgraded to Python 3.6 and it worked with:

pip3 install opencv-python
double-beep
  • 5,031
  • 17
  • 33
  • 41
Manish S
  • 801
  • 11
  • 12
4

I faced the same issue but the mistake which I was making was pip install python-opencv where I should have used pip install opencv-python. Hope this helps to anyone. It took me few hours to find.

2

As there is no proper wheel file in http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv?

Try this:(Worked in Anaconda Prompt or Pycharm)

pip install opencv-contrib-python

pip install opencv-python
Nick
  • 138,499
  • 22
  • 57
  • 95
1

A way to do this is to install Anaconda on your computer.

Then you should be able to do:

pip install opencv-python

or

conda install opencv
Akaisteph7
  • 5,034
  • 2
  • 20
  • 43
1

I had the same error. The first time I used the 32-bit version of python but my computer is 64-bit. I then reinstalled the 64-bit version and succeeded.

stateMachine
  • 5,227
  • 4
  • 13
  • 29
1

Install it by using this command:

pip install opencv-contrib-python
fcdt
  • 2,371
  • 5
  • 14
  • 26
1

I faced same issue while using Python 3.9.0. Upgrading python to latest version (currently 3.9.1) and reinstalling opencv-python solved this issue.

0

I got this error and I solved it by simply waiting.

I had similar problem:

ERROR: Could not find a version that satisfies the requirement opencv-contrib-python (from versions: none)

Command pip update was not resolving my issue. After lunch-time I tried again and it installed correctly the package. Maybe the server was down.

0

I update the version of python, and then the issue was addressed. Please refer to this video: https://www.youtube.com/watch?v=BQnpRbbEZB4

Annie
  • 1