1

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?

Erdnase
  • 595
  • You you check these 2 commands, add results if needed to post. which blender and ldd /usr/bin/blender |grep libavcodec – doug Dec 10 '17 at 15:32
  • @doug updated the post with the output. – Erdnase Dec 10 '17 at 15:53
  • There are several libraries installed by ffmpeg and blender links against most of them (I see nine here). Run ldd /usr/bin/blender | grep -E 'libav|libsw|libpo' to list them. Blender 2.76 is over 2 years old which is why it was built against an old ffmpeg version. – sambler Dec 10 '17 at 20:02
  • @sambler updated the question – Erdnase Dec 11 '17 at 15:49

2 Answers2

2

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:

sudo apt install libavcodec-ffmpeg-extra56 libavdevice-ffmpeg56 libavformat-ffmpeg56   
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  
sudo cp libavformat-ffmpeg.so.56 libavformat-ffmpeg.so.56.bak  
sudo mv libavformat-ffmpeg.so.56.bak libavformat.so.54    
sudo cp libavdevice-ffmpeg56 libavdevice-ffmpeg56.bak  
sudo mv libavdevice-ffmpeg56 libavdevice.so.54  

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:

sudo snap install blender --classic
karel
  • 114,770
  • Installation of 'libavcodec-ffmpeg-extra56' worked. Now how to make blender to point to this library? Could you also explain what is blender snap package? – Erdnase Dec 10 '17 at 14:24
  • My libavcodec-ffmpeg-extra56 was installed along with Blender in 16.04, and Blender configured itself automatically without requiring any manual configuration of the path to any of its required libraries. A snap package is usually installed as a standalone package that is installed with all of its dependencies in one snap package similar to the way programs are installed in Windows. – karel Dec 10 '17 at 14:27
  • Executed the step mentioned by you. Now it is looking for another library. Please see the Update 3 section in the question. – Erdnase Dec 10 '17 at 19:31
  • Thank you.. ! and I have finally installed blender through Snap. I am new to snap packages. Got introduced to it because of you. Could you please explain what is the difference between 'sudo snap install blender --classic' and this one? – Erdnase Dec 13 '17 at 03:17
  • A snap in classic confinement like the blender snap behaves as a traditionally packaged application with full access to the system. A snap that does not need to be installed with the --classic option like the blender-tpaw snap is a completely standalone that does not have full access to the system, so it is the safer snap of the two available blender snaps to install. – karel Dec 13 '17 at 04:31
  • Since, this is a workaround and the original problem affects anyone who is upgrading from 14.04 to 16.04, I would like to keep this question open. I am open to try out any future suggestions anyone like to offer on my system. Thank you anyway. – Erdnase Dec 16 '17 at 20:59
  • When someone explains how to trash your filesystem and get away with it, please comment so I can vote for it too. My current solution for that problem is to either disconnect the power cable or remove the battery. – karel Dec 17 '17 at 05:38
0

On clean Ubuntu 16.04 LTS the following packages were installed with blender:

 sudo apt-get install --reinstall blender blender-data \
  fonts-dejavu libavdevice-ffmpeg56 libboost-locale1.58.0 \
  libboost-regex1.58.0 libboost-thread1.58.0 libjemalloc1 libopenal-data \
  libopenal1 libopencolorio1v5 libopenimageio1.6 libspnav0 libtinyxml2.6.2v5 \
  libyaml-cpp0.3v5

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)).

N0rbert
  • 99,918
  • 1
    Yes, my system is upgraded from 14.04. Could you please explain how to remove the obselete packages? Synaptic is not installed and I am a bit unfamiliar of the way to remove this. So after removal, will a reinstall of blender will fix the issue? – Erdnase Dec 10 '17 at 14:18