I am trying to launch blender on Ubuntu 16.04. This is failing with the following error.
$ blender
blender: error while loading shared libraries: libavcodec.so.54: cannot open shared object file: No such file or directory
I have checked the answer here. As per the answer there, when I am trying to install the package libavcodec-extra-56
$ sudo apt-get install libavcodec-extra-56
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libavcodec-extra-56 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libavcodec-extra-56' has no installation candidate
A related question about this second issue ishere. But that answer is not related to blender.
How can I make my blender installation working?
Additional info which may be useful
$ apt-cache policy blender
blender:
Installed: 2.76.b+dfsg0-3build1
Candidate: 2.76.b+dfsg0-3build1
Version table:
*** 2.76.b+dfsg0-3build1 500
500 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
100 /var/lib/dpkg/status
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
Thank you for your time.
UPDATE
My system was upgraded from 14.04 to 16.04 long before. I have installed libavcodec-ffmpeg-extra56
as per below answer. Also I have removed blender by sudo apt-get purge --auto-remove blender
. Now again I installed blender,hoping that the dependencies will get correctly mapped. However, still when launching blender, it is looking for libavcodec.so.54
. How to map this correctly?
UPDATE 2 Output of the following commands as per the comment.
:~$ which blender
/usr/bin/blender
:~$ ldd /usr/bin/blender |grep libavcodec
libavcodec-ffmpeg.so.56 => /usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.so.56 (0x00007fc9c45e8000)
libavcodec.so.54 => not found
UPDATE 3 After executing the following steps by @karel , now the launch is failing because of some other library.
I executed
sudo apt install libavcodec-ffmpeg-extra56
cd /usr/lib/x86_64-linux-gnu/
sudo cp libavcodec-ffmpeg.so.56 libavcodec-ffmpeg.so.56.bak
sudo mv libavcodec-ffmpeg.so.56.bak libavcodec.so.54
Now while launching,
$ blender
blender: error while loading shared libraries: libavformat.so.54: cannot open shared object file: No such file or directory
UPDATE 4
~$ ldd /usr/bin/blender | grep -E 'libav|libsw|libpo'
/usr/bin/blender: /usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.so.56: version `LIBAVCODEC_54' not found (required by /usr/local/lib/libopencv_highgui.so.2.4)
libavformat-ffmpeg.so.56 => /usr/lib/x86_64-linux-gnu/libavformat-ffmpeg.so.56 (0x00007fb7e0107000)
libavcodec-ffmpeg.so.56 => /usr/lib/x86_64-linux-gnu/libavcodec-ffmpeg.so.56 (0x00007fb7decd8000)
libavutil-ffmpeg.so.54 => /usr/lib/x86_64-linux-gnu/libavutil-ffmpeg.so.54 (0x00007fb7dea69000)
libavdevice-ffmpeg.so.56 => /usr/lib/x86_64-linux-gnu/libavdevice-ffmpeg.so.56 (0x00007fb7de83b000)
libswscale-ffmpeg.so.3 => /usr/lib/x86_64-linux-gnu/libswscale-ffmpeg.so.3 (0x00007fb7de5ac000)
libswresample-ffmpeg.so.1 => /usr/lib/x86_64-linux-gnu/libswresample-ffmpeg.so.1 (0x00007fb7d8608000)
libavfilter-ffmpeg.so.5 => /usr/lib/x86_64-linux-gnu/libavfilter-ffmpeg.so.5 (0x00007fb7d4191000)
libavc1394.so.0 => /usr/lib/x86_64-linux-gnu/libavc1394.so.0 (0x00007fb7d1ffc000)
libavformat.so.54 => not found
libavutil.so.52 => not found
libswscale.so.2 => not found
libpostproc-ffmpeg.so.53 => /usr/lib/x86_64-linux-gnu/libpostproc-ffmpeg.so.53 (0x00007fb7c9ce4000)
libavresample-ffmpeg.so.2 => /usr/lib/x86_64-linux-gnu/libavresample-ffmpeg.so.2 (0x00007fb7c9ac2000)
So there are 13 libraries listed out of which 3 are missing. Now the question is how to install those or their alternatives on 16.04 and make blender find them?
libavcodec-extra-56 can be replaced with either libavcodec-ffmpeg-extra56 or libavcodec-ffmpeg56 in Ubuntu 16.04. I have Blender installed in Ubuntu 16.04, and it installed libavcodec-ffmpeg-extra56 as a dependency, not libavcodec-ffmpeg56. Open the terminal and type:
According to UPDATE 4 in your question your system is in a disheveled state of confusion. You should give up on the hopeless task of manually pasting Blender back together and install the Blender snap package instead of the apt package with the following command:
On clean Ubuntu 16.04 LTS the following packages were installed with blender:
After this blender starts and works normally.
This may fail in case if you have upgraded your system from previous version (14.04 LTS or 12.04 LTS).
It may have old obsolete packages.
You can list and remove them from Aptitude (Obsolete and Locally Created Packages category) or Synaptic (Status -> Installed (local or obsolete)).