0

I tried to follow the various instructions for installing libpng12.so which eventually led me to do the use the following command after downloading the deb file:

sudo gdebi  libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

But, unfortunately, the installation of the deb leads to the errors below:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Reading state information... Done

PNG library - runtime libpng is a library implementing an interface for reading and writing PNG (Portable Network Graphics) format files. . This package contains the runtime library files needed to run software using libpng. Do you want to install the software package? [y/N]:y /usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1 c = findall("[(/\S+[])]", msg)[0].lower() (Reading database ... 373964 files and directories currently installed.) Preparing to unpack libpng12-0_1.2.54-1ubuntu1.1_amd64.deb ... Unpacking libpng12-0:amd64 (1.2.54-1ubuntu1.1) ... dpkg: error processing archive libpng12-0_1.2.54-1ubuntu1.1_amd64.deb (--install): unable to install new version of '/lib/x86_64-linux-gnu/libpng12.so.0': No such file or directory Processing triggers for libc-bin (2.35-0ubuntu3) ... Errors were encountered while processing: libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

Does anyone know why I get these errors? Thanks a lot.

mark leeds
  • 131
  • 2
  • 9

1 Answers1

0

This answer is for R users on Ubuntu 22.04 who get the error described in my question when trying to load the latticeExtra package during an R session on Ubuntu 22.04. The three steps I did were the following. (This was after a lot of googling and many dead ends !!!!! ).

Note that a lot of this answer was obtained using the instructions from user1335274 at the link below. I'm just writing them out step by step.

error while loading shared libraries: libpng12.so.0

STEP 1):

I went to ubuntuupdates.org and downloaded libpng12-0_1.2.54-1ubuntu1_amd64.deb

Then I extracted the files from the deb using ar x libpng12-0_1.2.54-1ubuntu1_amd64.deb

This resulted in two files being in my directory called data.tar.xz and control.tar.xz

STEP 2):

I didn't use the control.tar.xz because it was not needed. I obtained the files from data.tar.xz using

tar xvf data.tar.xz.

This downloaded the whole file structure that existed in the xz file. I then copied the two files below into my /usr/local/lib directory. I wasn't sure what the best place was to put them but this seemed reasonable since it wasn't crowded with a lot of other files.

/lib/x86_64-linux-gnu/libpng12.so.0.54.0

/lib/x86_64-linux-gnu/libpng12.so.0

STEP 3):

So, once I had the files above in my usr/local/lib, I then needed to modify my LD_LIBRARY_PATH in my dot bashrc file so that it included the usr/local/lib directory when paths were looked for.

I did this by putting

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

inside my dot bashrc file.

Once I did the above, I no longer had a problem when trying to install the latticeExtra package from R when running Ubuntu 22.04. I hope that this helps future R users using Ubuntu 22.04.

NB: Note that often a solution to this kind of problem is to just re-install the respective R package on the new version of Ubuntu. Unfortunately, this was not the case for latticeExtra.

mark leeds
  • 131
  • 2
  • 9