Easiest way to install OpenCV for python in Raspberry pi within few minutes

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ต.ค. 2024
  • In this video I will show you how to install OpenCV for python in the easiest way within few minutes.
    Commands used in this video:
    sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-100
    sudo apt-get install libqtgui4 libqtwebkit4 libqt4-test
    sudo apt-get install libatlas-base-dev
    sudo apt-get install libjasper-dev
    wget bootstrap.pypa...
    sudo python3 get-pip.py
    sudo pip3 install opencv-contrib-python
    **Edit : While importing opencv if you get error like "ImportError: /usr/local/lib/python3.7/dist-packages/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8" ,then use
    "sudo pip3 install opencv-contrib-python==3.4.6.27" - this command as the latest version of openCV doesn't work with RPi.
    After this if you get "ImportError: libhdf5_serial.so.103: cannot open shared object file: No such file or directory" - this error then use the below command:
    sudo apt-get install python3-h5py
    For future updates follow us on facebook: / sparklers2018
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 88

  • @mohanamanikantarapolu6647
    @mohanamanikantarapolu6647 3 ปีที่แล้ว +3

    "Easiest way to install OpenCV for python in Raspberry pi within few minutes" The title deserves evrything bro........100000% working even installed in few minitues (

  • @sebastianzapata3199
    @sebastianzapata3199 3 ปีที่แล้ว +19

    The first command didn't work for me, but this command replaced it well:
    sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103

    • @zeng6769
      @zeng6769 2 ปีที่แล้ว

      I'm sorry, but mine said,
      E:unable to locate package libhdf5-103.
      So, what should I do ?

  • @vishalj27
    @vishalj27 4 ปีที่แล้ว +8

    Check the message after executing the first line, if it failed then change the first line to "sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103" it will work.
    I neglected the message at first and it didn't work.

    • @billtrondsen
      @billtrondsen 3 ปีที่แล้ว +2

      Also fixed my install. Thank you Vishal and SPARKLERS!

    • @ihsanpratama2926
      @ihsanpratama2926 3 ปีที่แล้ว

      @@billtrondsen same with me thanks

    • @zeng6769
      @zeng6769 2 ปีที่แล้ว

      I'm sorry, but mine said,
      E:unable to locate package libhdf5-103.
      So, what should I do ?

  • @thapamilan7
    @thapamilan7 3 ปีที่แล้ว +1

    "sudo pip3 install opencv-contrib-python==3.4.6.27"
    This throws an error: No matching distribution found for opencv-contrib-python==3.4.6.27...
    did anyone solve this probelm ?

  • @ihsanpratama2926
    @ihsanpratama2926 3 ปีที่แล้ว +1

    work for me . thankyou very much.
    but for last step im stuck for a long time with response
    Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
    Requirement already satisfied: numpy>=1.14.5 in /usr/lib/python3/dist-packages (from opencv-contrib-python) (1.16.2)
    Building wheels for collected packages: opencv-contrib-python
    Building wheel for opencv-contrib-python (PEP 517)
    and i solve with this
    cancel and try this
    "sudo pip3 install opencv-contrib-python==3.4.6.27"

  • @antonioislasromero5539
    @antonioislasromero5539 4 ปีที่แล้ว +12

    hi i'm from Mexico (Saludos por cierto y buen video) if somebody got the issuse: " ImportError: libhdf5_serial.so.103: cannot open shared object file: No such file or directory" can try: "sudo apt install libhdf5-103" it work's for me :) regards! and nice video

    • @petercalderbank1788
      @petercalderbank1788 4 ปีที่แล้ว +1

      did you solve this problem I have exactly the same

    • @antonioislasromero5539
      @antonioislasromero5539 4 ปีที่แล้ว

      @@petercalderbank1788 just replace the first line with the line that I put in the comment above

    • @harshparmar7704
      @harshparmar7704 4 ปีที่แล้ว

      @@antonioislasromero5539 Which Command? I also getting same error

  • @sumaiyashahid5532
    @sumaiyashahid5532 3 ปีที่แล้ว +2

    Hey, I m getting an error "unable to locate package libjasper-dev while running "sudo apt-get install libjasper-dev". Can you tell ne how to resolve it?

  • @fatimaameeri957
    @fatimaameeri957 3 ปีที่แล้ว +1

    Hey, I m getting an error "unable to locate package libjasper-dev while running "sudo apt-get install libjasper-dev". Can you tell ne how to resolve it? please help

  • @mtheory1999
    @mtheory1999 3 ปีที่แล้ว +1

    THIS VIDEO WILL INSTALL OPEN CV on your RPI...just make sure to read the error messages and the edit in the description.

  • @SPARKLERSWeAreTheMakers
    @SPARKLERSWeAreTheMakers  4 ปีที่แล้ว +8

    While importing opencv if you get error like "ImportError: /usr/local/lib/python3.7/dist-packages/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8" ,then use
    "sudo pip3 install opencv-contrib-python==3.4.6.27" - this command as the latest version of openCV doesn't work with RPi currently.
    After this if you get "ImportError: libhdf5_serial.so.103: cannot open shared object file: No such file or directory" - this error then use the below command:
    sudo apt-get install python3-h5py

    • @onisimrosu1396
      @onisimrosu1396 4 ปีที่แล้ว

      I have a problem,i still have the same error even after installing that version,can you please help me? I have opencv 4.1.1.26 and numpy 1.16.2

    • @TOP1_ENG
      @TOP1_ENG 4 ปีที่แล้ว

      when i run this command say : " ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
      opencv-contrib-python==3.4.6.27 from www.piwheels.org/simple/opencv-contrib-python/opencv_contrib_python-3.4.6.27-cp37-cp37m-linux_armv7l.whl#sha256=c2bc36033b23aa8fb989ffa1b4e96e8beae005bc527f486d2a32982b5ea41925:
      Expected sha256 c2bc36033b23aa8fb989ffa1b4e96e8beae005bc527f486d2a32982b5ea41925
      Got 8ae508287c0321a4682b6a7afa49484fc8eae042180d7a82c415e1b9f2a1a134 " . how i can solve this problem brother.

    • @IamG3X
      @IamG3X 4 ปีที่แล้ว

      @@onisimrosu1396 try this tutorial. th-cam.com/video/H7k1YApU0pg/w-d-xo.html

    • @IamG3X
      @IamG3X 4 ปีที่แล้ว

      @@onisimrosu1396 github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/issues/67
      go to that page and Ctrl+F to search for "Zach-Op". Follow his steps and you should be able to install OpenCV. The version 4 is not compatible with RPi according to some users.

    • @techconsultingsolutions392
      @techconsultingsolutions392 4 ปีที่แล้ว

      @@IamG3X Thanks!

  • @iobotic
    @iobotic 4 ปีที่แล้ว +1

    I'm trying to run the line "sudo pip3 install opencv-contrib-python" but I get the following error : "Could not find any downloads that satisfy the requirement opencv-contrib-python...." and then "No distributions at all found for opencv-contrib-python"
    How can I fix it?

  • @vince086
    @vince086 4 ปีที่แล้ว +1

    How would I got about getting this to work for python 2.7? Instructions worked perfectly for python 3.

  • @MR-db6zw
    @MR-db6zw 4 ปีที่แล้ว +1

    I’ve tried like 100 descriptions to install it, this was the easiest and only working one. Thank you very much!!!

  • @katefernandez240
    @katefernandez240 4 ปีที่แล้ว +1

    sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103
    E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
    E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
    I get this error

  • @thendomudau6040
    @thendomudau6040 4 ปีที่แล้ว +1

    mmmmmhwaaaa ndo livhuesa , thank you so much

  • @VaibhavKKM
    @VaibhavKKM 4 ปีที่แล้ว

    'sudo' is not recognized as an internal or external command,
    operable program or batch file.
    pls help

  • @hug9259d
    @hug9259d 4 ปีที่แล้ว +1

    thank you, finally a good guide.

  • @rajatpanda5476
    @rajatpanda5476 2 ปีที่แล้ว

    Thank you so much. I was struggling for last 1 month to install opencv. Finally thru this video I was able to install successfully

  • @josepuga381
    @josepuga381 4 ปีที่แล้ว +1

    awesome video! after countless videos of how to install opencv on pi zero w this is by far the best the others took HOURS.

    • @farvezfarook3422
      @farvezfarook3422 2 ปีที่แล้ว

      because the other methods compile the library in the pi

  • @mustafakendiguzel468
    @mustafakendiguzel468 3 ปีที่แล้ว

    can we see camera on rasperry-pi lite if we start the apllication

  • @andresbarba1584
    @andresbarba1584 2 ปีที่แล้ว

    It works the best tutorial

  • @fernandotagliaferro2134
    @fernandotagliaferro2134 3 ปีที่แล้ว

    Finalmente sò riuscito a caricà CV senza problemi....Grazie di cuore...!!!

  • @imjustaguy2003
    @imjustaguy2003 3 ปีที่แล้ว

    Thank you! This was very helpful.

  • @obypanda
    @obypanda 5 ปีที่แล้ว

    Goood and thank you i'll try to do same

  • @anupjadhav3012
    @anupjadhav3012 4 ปีที่แล้ว

    I am trying to install it but in 1st command it shows me error that libhdf5-100 has no installation package

  • @somebody9033
    @somebody9033 4 ปีที่แล้ว +1

    libhdf5-100 "Unable to locate package" Please help

    • @fernandosaraiva672
      @fernandosaraiva672 4 ปีที่แล้ว +1

      Hey friend, try this: change libhdf5-100 for libhdf5-103

    • @somebody9033
      @somebody9033 4 ปีที่แล้ว

      @@fernandosaraiva672 nope doesn't work. thanks for the quick reply though

    • @timmarkbaker
      @timmarkbaker 4 ปีที่แล้ว +1

      @@somebody9033 Update 14th April 2020. It works for me when I used
      sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103
      and
      sudo pip3 install opencv-contrib-python==3.4.6.27
      with al the other lines of the script as initially marked

    • @somebody9033
      @somebody9033 4 ปีที่แล้ว

      @@timmarkbaker doesn't work either, but thanks a lot for the very swift reply!

    • @bestoftiktokromania4850
      @bestoftiktokromania4850 4 ปีที่แล้ว

      sudo apt-get install libhdf5-serial-dev

  • @ssgoh4968
    @ssgoh4968 3 ปีที่แล้ว

    Super. Thank you.

  • @TOP1_ENG
    @TOP1_ENG 4 ปีที่แล้ว

    HI every one . When i run the last command say to me: "Requirement already satisfied: numpy>=1.16.2 in /usr/lib/python3/dist-packages (from opencv-contrib-python) (1.16.2)" . And dose not work need help please

    • @natebrownnz
      @natebrownnz 4 ปีที่แล้ว

      Try re-install it.

    • @ihsanpratama2926
      @ihsanpratama2926 3 ปีที่แล้ว +1

      @@natebrownnz same with me
      cancel and try this
      sudo pip3 install opencv-contrib-python==3.4.6.27"
      because latest version of openCV doesn't work with RPi.

  • @ilanaizelman3993
    @ilanaizelman3993 3 ปีที่แล้ว

    Thanks alot!!

  • @shyamprassad103
    @shyamprassad103 4 ปีที่แล้ว

    Saved me

  • @genarojavierperezlopez8273
    @genarojavierperezlopez8273 4 ปีที่แล้ว

    Thanks!

  • @JARC99_
    @JARC99_ 4 ปีที่แล้ว

    Hello, excellent video!
    I wanted to ask, what would be the minimum amount of RAM I need to run OpenCV. I'm planning on buying a raspberry pi 4 but I don't know if th 2GB will be enough for openCV object tracking :-/

    • @betulsahin5419
      @betulsahin5419 2 ปีที่แล้ว +1

      Did u find the answer?

    • @JARC99_
      @JARC99_ 2 ปีที่แล้ว +1

      @@betulsahin5419 The 4 GB ram model seems to be enough for simple tasks

    • @betulsahin5419
      @betulsahin5419 2 ปีที่แล้ว

      @@JARC99_ I appreciate for your return.

  • @nuhakhan7365
    @nuhakhan7365 3 ปีที่แล้ว

    It is taking forever to install install opencv. like more than 5 hrs
    please help me out guys.

    • @ihsanpratama2926
      @ihsanpratama2926 3 ปีที่แล้ว +1

      Building wheels for collected packages: opencv-contrib-python
      Building wheel for opencv-contrib-python (PEP 517) ... -
      ??? are you so ?

    • @mohanamanikantarapolu6647
      @mohanamanikantarapolu6647 3 ปีที่แล้ว

      @@ihsanpratama2926 yes bro mine also stucked at this line...what should I do ......should I break the command

    • @ihsanpratama2926
      @ihsanpratama2926 3 ปีที่แล้ว

      @@mohanamanikantarapolu6647 see my comment

    • @ihsanpratama2926
      @ihsanpratama2926 3 ปีที่แล้ว +1

      @@mohanamanikantarapolu6647 Cancel amd try this "sudo pip3 install opencv-contrib-python==3.4.6.27"

    • @mohanamanikantarapolu6647
      @mohanamanikantarapolu6647 3 ปีที่แล้ว +1

      @@ihsanpratama2926 thanks a lot its works fine

  • @shrutir8864
    @shrutir8864 3 ปีที่แล้ว

    I am stuck in last command ......it is just running from more than 4 hours! why is it taking so long? should I cancel and re run the last command?

    • @ihsanpratama2926
      @ihsanpratama2926 3 ปีที่แล้ว +1

      same with me "Building wheels for collected packages: opencv-contrib-python
      Building wheel for opencv-contrib-python (PEP 517) ... -
      " are you so ?

    • @ihsanpratama2926
      @ihsanpratama2926 3 ปีที่แล้ว +3

      i solve the problem this way
      cancel and try this
      sudo pip3 install opencv-contrib-python==3.4.6.27"
      because latest version of openCV doesn't work with RPi.

    • @shrutir8864
      @shrutir8864 3 ปีที่แล้ว

      @@ihsanpratama2926 Thanks

    • @suhasl960
      @suhasl960 3 ปีที่แล้ว

      @@ihsanpratama2926 Thank you :)

  • @svenplus600
    @svenplus600 5 ปีที่แล้ว

    I get a hash mismatch error with the final command: 'sudo pip3 install opencv-contrib-python'.
    Is there a workaround or solution?

    • @SPARKLERSWeAreTheMakers
      @SPARKLERSWeAreTheMakers  5 ปีที่แล้ว

      Make sure you have a good internet connection and use sudo pip3 install --no-cache-dir opencv-contrib-python