Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

ImportError: libavcodec.so.56: cannot open shared object file: No such file or directory #10

Closed
inzamam-iqbal opened this issue Oct 7, 2017 · 29 comments

Comments

@inzamam-iqbal
Copy link

I did exactly as you said. but when I type import cv2 it gives an error "ImportError: libavcodec.so.56: cannot open shared object file: No such file or directory"

@lewj85
Copy link

lewj85 commented Oct 8, 2017

Having the same problem.

@jabelone
Copy link
Owner

Did you install all of the dependencies in the prior steps?

@jabelone
Copy link
Owner

The build is also a little out of date, so it could be that too. I'll try to make an updated version soon.

@kglasnapp
Copy link

I am also having the problem. I work with a bunch of student on a First Robotics Team and they would love it if you could update the build to avoid the ImportError: libavcodec.so.5 prolem.

Thanks so much for you efforts.

@lewj85
Copy link

lewj85 commented Oct 16, 2017

An update would be appreciated by our robotics team over at NYU as well!

@rbirkby
Copy link

rbirkby commented Oct 22, 2017

This must be a raspbian stretch related issue. I have reverted to a fresh (most recent) jessie image and it works:

>>> import cv2
>>> cv2.__version__
'3.1.0'

@kglasnapp
Copy link

Thank rbirkby how do you get the latest jessie image?

@rbirkby
Copy link

rbirkby commented Oct 22, 2017

@kglasnapp
Copy link

Thanks -- sadly when the command
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
runs it installs libavcodec.so.57.
When the import cv2 runs it expects libavcodec.so.56
Even with the version you suggested above.

Could we somehow rebuild the latest-OpenCV.deb so it has the latest version of opencv.

Thanks so much for you efforts. I hope we can find a solution.

@rbirkby
Copy link

rbirkby commented Oct 23, 2017

Strange. That was not my experience. My only deviation from the script was to install numpy with apt instead of pip.

@kglasnapp
Copy link

rbirkby -- Did you start with clean Jessie build? Did you do sudo apt-get upgrade? I wonder why yours worked and mine failed.

@rbirkby
Copy link

rbirkby commented Oct 24, 2017

Yes. Burned it to an sd card. apt-get update/upgrade.

@kglasnapp
Copy link

rbirkby -- Thanks so very much. It finally worked. I do not know what I did wrong.

Keith

@AadityaRavindran
Copy link

AadityaRavindran commented Nov 7, 2017

I faced the same issue @kglasnapp
I have the 57 version of libavcodec.

I uninstalled this version and installed opencv using this(Takes less than 5 min!) and it works like a charm:
sudo apt-get install libopencv-dev python-opencv python-picamera

@ghost
Copy link

ghost commented Nov 10, 2017

hey @inzi119 did you find the solution to the problem because i m also getting same problem.

@maxisme
Copy link

maxisme commented Nov 15, 2017

I also am having this issue!

@Degeerdoethetweer
Copy link

Degeerdoethetweer commented Dec 6, 2017

Hi! I'm also having this issue. Has anyone managed to find a solution?

EDIT: Using an older version of Jessie solved it for me.
( https://downloads.raspberrypi.org/raspbian/images/raspbian-2017-07-05/ )

@iaansari
Copy link

Got it working on my Pi Zero W with Jessie. Does not work on the latest release of Raspbian "Stretch", but starting fresh with Jessie was smooth sailing.

@wbadry
Copy link

wbadry commented Dec 26, 2017

if @jabelone could recompile the latest version of OpenCV with Raspberry Stretch, this would be much appreciated.

@jabelone
Copy link
Owner

Recompiling a 3.4 version now.

@javacasm
Copy link

Sorry, but Where is the 3.4 version?

Thanks for your work!!!

@CosmaP
Copy link

CosmaP commented Apr 17, 2018

Hi, I am still getting this issue.

@lukinsb
Copy link

lukinsb commented May 7, 2018

Hello, I am still having this issue too.

@sarim987
Copy link

I am also having this issue, could you please update it?

@danarnold
Copy link

danarnold commented Jun 24, 2018

For those still having this issue, search your distro's package manager for compatibility libraries. On Arch Linux, I was able to install ffmpeg-compat-57 and get it working.

@nathangonzalez95
Copy link

@danarnold I am new to Linux and RPi. Would you be able to give a few more details or resources on how to install ffmpeg-compat-57? Any help is much appreciated,

@danarnold
Copy link

@nathangonzales95 You need to search your distribution's package manager for a compatibility library for this older version of ffmpeg. Or, you could try downgrading your version of ffmpeg. I'm using a desktop running Arch Linux, not a raspberry pi, so I don't know anything about your system.

@Alexander-flyer
Copy link

Alexander-flyer commented Oct 10, 2018

@danarnold
installing ffmpeg version(2.8.6) is work, thanks a lot~

@srohit0
Copy link

srohit0 commented Apr 16, 2019

Installing opencv-contrib-python resolved this issue on 18.04.2 LTS (Bionic Beaver)

pip install opencv-contrib-python

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests