3

I am using Raspbian Stretch on my RPi 3, I wanted to install OpenCV on it.
I did this before by following the instructions detailed here . The problem is that this takes a very long time.
Lately, I've been looking in the internet, so I found in this link that installing Opencv only needs to run these commands pip install opencv-python and pip install opencv-contrib-python. I tried it on Ubuntu with my PC and it worked well.
So my question is: is it possible to install Opencv on a RPi 3 by just running these commands instead of compiling it from source?

asked Aug 30, 2018 at 13:49
7
  • I really do not know , my fault, how to respond, but who or what is stopping you to try it ? Secondly - if the "manual: states it will take OpenCV time to install due to dependencies - why cannot just accept that? Commented Aug 30, 2018 at 13:58
  • Unfortunately, it is a bit late now.. I am already in the last step of the 'usual' method which is compiling from source. So at least I have to wait till it finishes to try this one. Commented Aug 30, 2018 at 14:02
  • Have you favorite snack / beverage in the meantime. Cheers Commented Aug 30, 2018 at 14:03
  • As I read in this link: raspberrypi.stackexchange.com/questions/77307/…, precompiled binaries work only for some specific architectures (X86 and X86_64 but not ARM), which means that the only available solution to install Opencv on RPi is to compile it from source. Commented Aug 30, 2018 at 14:12
  • 1
    @singrium: precompiled wheels of opencv-python and opencv-contrib-python for arm / python 3 are available from piwheels (www.piwheels.org) Commented Aug 30, 2018 at 14:21

1 Answer 1

5

Precompiled wheels of opencv-python and opencv-contrib-python for arm / python 3 are available from piwheels (www.piwheels.org). On current Raspbian Stretch this already pre-configured.
On other distros (such as Raspbian Jessie) it can easily be added by creating the file '/etc/pip.conf' containing:

[global]
extra-index-url=https://www.piwheels.org/simple

See also Installing scipy 1.0.0 in python3 environment

singrium
1351 silver badge8 bronze badges
answered Aug 30, 2018 at 14:46
6
  • Di you try installing Opencv using piwheels before? As I said before, I am in the last step of compiling Opencv from source and I am afraid that if I abort it now and try piwheels it will not work. Commented Aug 30, 2018 at 15:08
  • Not 'in anger', meaning I downloaded it, but I cannot test if it's actually working ATM. Maybe you can create a virtual environment and try to download it in that environment. Commented Aug 30, 2018 at 15:22
  • This doesn’t work either; same "no matching distribution error" Commented Nov 22, 2018 at 20:39
  • @NoahPentecost on what model Pi / OS + version / Python version? And what is the exact command you use? Commented Nov 22, 2018 at 20:57
  • This worked on a RasPi 3 Model B v1.2, under Stretch. This is a fresh install, and I do not understand the claim that Stretch checks PiWheels out of the box. If really pre-configured, the system images we get are broken. Anyway, thanks @Dirk for compiling a solution (note that this solution checks PiWheel after, not before PyPi, as expected in some Stretch documentations). Commented Jan 30, 2019 at 0:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.