Ask Your Question
0

ros-melodic-cv-bridge is depending on libavcodec.so.56

asked 2020-09-08 22:05:41 -0500

H+ gravatar image

updated 2020-11-27 01:16:48 -0500

jayess gravatar image

I installed ros-melodic-cv-bridge apt-get install ros-melodic-cv-bridge

But when I run python

from cv_bridge import CvBridge  
CvBridge()   
Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File "/usr/local/lib/python2.7/dist-packages/cv2/__init__.py", line 89, in <module>  
    bootstrap()   File "/usr/local/lib/python2.7/dist-packages/cv2/__init__.py", line 79, in bootstrap  
    import cv2  
 ImportError: libavcodec-ffmpeg.so.56: cannot open shared object file: No such file or directory

I don't have libavcodec-ffmpeg.so.56. And when I search for libavcodec and ffmpeg packages all I see for Ubuntu 18.04 (which is what melodic runs on) is version 57.

Where does this library come from?

I know melodic changed such that it now uses the host install of opencv - is that my problem? I'm on OpenCv 3.4.5.

edit retag flag offensive close merge delete

Comments

/usr/local/lib/python2.7

Do you have a Python 2.7 installed from source on your machine?

I would expect system-provided (and managed) Python installs on Ubuntu to be located in /usr/lib, /usr/bin, etc.

gvdhoorn gravatar image gvdhoorn  ( 2020-09-09 23:31:33 -0500 )edit

Does anyone have an answer to this? I've spent days on it with no success.

Is this right? Melodic runs on 18.04, which deletes/overwrites libavcodec-ffmpeg.so.56 and replaces it with libavcodec-ffmpeg.so.57 , thereby ensuring opencv won't import (at least in Python).

To fix this do you:

  1. somehow reinstate/reinstall libavcodec-ffmpeg.so.56 i
  2. install a later version of opencv that depends on > 56

1) as above, is dodgy if you use an older repository

2) I can't find out anywhere what versions don't depend on 56. Also, there seems a difference whether are using python2 or python3.

One thing I would not recommend unless you want to qo quite mad, is try to setup melodic with python3 support.

RobB gravatar image RobB  ( 2020-11-26 22:23:27 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-09-09 13:25:11 -0500

H+ gravatar image

Figured it out. I have installed opencv 3.4.5 which has dependencies on some older versions of the libavcodec, libavformat, libswscale etc.. libraries - older than are available in the bionic repositories.

Solution was to add the xenial repositories to my sources.list, apt update and then I could apt search for the missing libraries one by one and install the required older version.

edit flag offensive delete link more

Comments

Solution was to add the xenial repositories to my sources.list, apt update and then I could apt search for the missing libraries one by one and install the required older version.

For future readers: this is not a solution, but at best a work-around.

Mixing and matching libraries from different Ubuntu versions (or any OS really) is not a good idea, and can lead to all sorts of ABI compatibility problems which typically only manifest themselves in hard-to-diagnose SEGFAULTs and similar crashes.

gvdhoorn gravatar image gvdhoorn  ( 2020-09-09 23:29:37 -0500 )edit

Thats a great point thanks. How would you suggest (high level) approaching this? Considering I want to run OpenCV 3.4.5 on Ubuntu 18.04 <- or is that fundamentally the problem.

H+ gravatar image H+  ( 2020-09-10 14:22:58 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-09-08 22:05:41 -0500

Seen: 196 times

Last updated: Nov 27 '20