OpenCV in Ubuntu 17.04

48,176

Solution 1

I found the answer here: https://github.com/opencv/opencv/issues/8622

sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev

References to 17.04 packages no longer work.

Solution 2

Installing the opencv library from the repository worked for me. Just both the following commands.

sudo apt-get install opencv-data 
sudo apt-get install libopencv-dev 

After installing that it worked as before. Previously I had build opencv myself. The one from the repository will work apparantely.

Solution 3

libjasper-dev is not available for Ubuntu 17.04.

So you need to install the package from an earlier release. Try the following:

echo "deb http://us.archive.ubuntu.com/ubuntu/ yakkety universe" | sudo tee -a /etc/apt/sources.list

This will add a new line to the sources.list file in /etc/apt. It will allow installation of packages from 16.10.

You should be able to install the missing package libjasper-dev now with the following commands:

sudo apt-get update
sudo apt-get install libjasper-dev
Share:
48,176

Related videos on Youtube

mjm
Author by

mjm

Updated on May 23, 2020

Comments

  • mjm
    mjm about 4 years

    I had OpenCV installed in my Ubuntu machine running Ubuntu 16.10. Recently I updated to the latest Ubuntu 17.04 and OpenCV failed to work.

    I am getting the following error.

    ImportError: libjasper.so.1: cannot open shared object file: No such file or directory
    

    I tried to install libjasper. With the command sudo apt-get install libjasper-dev

    But I am getting the error E: Unable to locate package libjasper-dev

    How can I fix it ?

    • eyllanesc
      eyllanesc about 7 years
      You could look up the package name with: apt-cache search libjasper or apt-cache search jasper
    • mjm
      mjm about 7 years
      @eyllanesc The package doesnt seems to be available for Ubuntu 17.04. Please check this link. packages.ubuntu.com/search?keywords=libjasper-dev
  • Antonio
    Antonio about 7 years
    Rebuilding your opencv disabling jpeg2000 support would work as well. Building opencv is usually the most powerful way of installing it, see stackoverflow.com/questions/26592577/… (votes strongly converged to the "build it yourself" version)
  • Ofer Sadan
    Ofer Sadan almost 7 years
    tnx for this answer!
  • Shameerariff
    Shameerariff almost 7 years
    Having the dependencies issues in version 17.xx, still a good try
  • gkhaos
    gkhaos about 6 years
    affirmed on lubuntu 17.10
  • Admin
    Admin almost 6 years
    This did not work on Ubuntu 18.04. The below answer does, however.
  • sirop
    sirop over 5 years
    sudo add-apt-repository "deb security.ubuntu.com/ubuntu xenial-security main" ; sudo apt update ; sudo apt install libjasper1 libjasper-dev works on Ubuntu 18.04
  • A.Ametov
    A.Ametov about 5 years
    Malformed entry 54 in list file /etc/apt/sources.list (URI parse) after @sirop command performed
  • sirop
    sirop about 5 years
    Try it with single quotes: sudo add-apt-repository 'deb http://security.ubuntu.com/ubuntu xenial-security main' or manually edit /etc/apt/sources.list .
  • dolgom
    dolgom almost 5 years
    'us.archive.ubuntu.com' should be 'old-releases.ubuntu.com'
  • dolgom
    dolgom almost 5 years
    not worked in Ubuntu 18.04 for me. I got 404 Not Found error for security.ubuntu.com/ubuntu xenial-security/main arm64 Packages
  • Bms bharadwaj
    Bms bharadwaj almost 5 years
    awesome :D. worked for me as well, after struggling for 2 hrs with other methods.
  • Chau Giang
    Chau Giang over 4 years
    worked in 18.04 for me when I tried to install opencv
  • gone
    gone over 4 years
    Ign:9 http://security.ubuntu.com/ubuntu xenial-security/main arm64 Packages Ign:9 http://security.ubuntu.com/ubuntu xenial-security/main arm64 Packages Err:9 http://security.ubuntu.com/ubuntu xenial-security/main arm64 Packages 404 Not Found [IP: 91.189.91.26 80]
  • cagri
    cagri over 3 years
    is there any really working solution for this?