ImportError: libavcodec.so.56: cannot open shared object file: No such file or directory
25,860
Solution 1
This means that you don't have the correct libraries installed. Try a search using pacman -Ss libav
.
On OpenSuSE this is part of libavcodec52
which says that it is related to ffmpeg
. Check if you have ffmpeg
installed at well as dependencies should pull in libavcodec.
EDIT
After reading the arch documentation, it looks like ffmpeg
does provide the libavcodec
requirement.
Solution 2
Same issues faced on centOS when checking the ffmpeg packages are installed and version :
#/usr/local/bin/ffmpeg
/usr/local/bin/ffmpeg: error while loading shared libraries: libavdevice.so.56: cannot open shared object file: No such file or directory
or
# ldd `which ffmpeg`
linux-vdso.so.1 => (0x00007fffb32d8000)
libavdevice.so.56 => not found
libavfilter.so.5 => not found
libavformat.so.56 => not found
libavcodec.so.56 => not found
libpostproc.so.53 => not found
libswresample.so.1 => not found
libswscale.so.3 => not found
libavutil.so.54 => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f75f2ef8000)
libm.so.6 => /lib64/libm.so.6 (0x00007f75f2c74000)
libc.so.6 => /lib64/libc.so.6 (0x00007f75f28df000)
/lib64/ld-linux-x86-64.so.2 (0x00007f75f3126000)
Solution:
Now, check the library path, open ld.so.conf
# vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib
/usr/lib
Finally save and quit :wq!
Now, check with same command,
# ffmpeg -v
ffmpeg version N-73873-gcee7acf-syslin Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
configuration: --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --extra-libs=-lx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslin --enable-libass --enable-libvpx --enable-zlib --enable-gpl
libavutil 54. 28.100 / 54. 28.100
libavcodec 56. 50.101 / 56. 50.101
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 25.100 / 5. 25.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Related videos on Youtube

Author by
Vahid Kharazi
Updated on September 18, 2022Comments
-
Vahid Kharazi 3 months
I was installed opencv with pacman, when i try to import opencv, i have this error:
>>> import cv2 Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: libavcodec.so.56: cannot open shared object file: No such file or directory
how can I fix this error?
EDIT
sudo pacman -Ss libav extra/gst-libav 1.4.4-1 [installed: 1.4.1-1] Gstreamer libav Plugin extra/libavc1394 0.5.4-2 [installed] A library to control A/V devices using the 1394ta AV/C commands. community/ffms2 2.20-2 [installed] A libav/ffmpeg based source library and Avisynth plugin for easy frame accurate access
-
Vahid Kharazi about 8 years@SailorCiro see my edit
-
SailorCire about 8 years@28 So it doesn't look like it is installed, unless it is in
ffms2
. Hmm...What is the output ofldconfig -v | grep libavcodec.so
? -
Vahid Kharazi about 8 yearsldconfig: Path `/usr/lib64' given more than once ldconfig: Can't stat /usr/libx32: No such file or directory libavcodec.so.55 -> libavcodec.so.55.69.100
-
SailorCire about 8 years@28 So, you have
libavcodec
version 55 and you needlibavcodec
version 56. -
Vahid Kharazi about 8 yearshow i can update it? or install 56 v?
-
SailorCire about 8 years@28 best answer is to wait until someone updates the package; however, you could download and compile by yourself. I don't recommend it. I recommend asking one of the maintainers about this