Linux Centos 7 unable to install png and EBImage package on R

I am fighting to install png and EBImage R package on my linux centos 7 machine. I have always this error message:

    Error: package or namespace load failed for ‘png’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/rico/R/x86_64-redhat-linux-gnu-library/3.6/00LOCK-png/00new/png/libs/': cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/rico/R/x86_64-redhat-linux-gnu-library/3.6/png’
Warning in install.packages :
  installation of package ‘png’ had non-zero exit status

The downloaded source packages are in

I tried to do:

yum install libpng-devel

and it output me:

Package 2:libpng-devel-1.5.13-7.el7_2.x86_64 already installed and latest version
Nothing to do

Any idea how to solve this issue ?

Unix & Linux Asked on November 21, 2021

3 Answers

3 Answers

I managed to install EBImage on my Linux centos 7 machine. sudo cp /usr/local/lib/ /usr/lib resolved the issue

Answered by user979974 on November 21, 2021

For some reason having Anaconda on RHEL/Centos 7 causes this issue. Probably because Anaconda installs a more recent version of libpng.

I was able to get another package installed that had the same png package dependency by temporarily removing anaconda from the PATH recognized by R. Once I did this, the png package and its dependent package installed with no issues.

Answered by Mark Nielsen on November 21, 2021

It looks like your R package needs (1.6. branch) whereas the default on CentOS 7 is the one you installed (1.5 branch, available via libpng package).

If you don't mind using a commercial repository, libpng 1.6 is available at GetPageSpeed repo:

sudo yum -y install
sudo yum install libpng16

Alternatively, although highly discouraged due to placing non-packaged files on the root filesystem, you can use precompiled binaries of libpng16 located here: extract the archive, create symlink from the precompiled library file over to, provide custom include path from the archive to the R package installation, etc...

Answered by Danila Vershinin on November 21, 2021

Add your own answers!

Related Questions

How do I syntax check a Zsh script?

1  Asked on August 9, 2020 by akhil-jalagam


How can I swap my two screens, left to right?

5  Asked on August 4, 2020 by ripper234


Adding suffix to filename during for loop in bash

1  Asked on August 3, 2020 by mishal-ahmed


Why are aliases skipped if escaped?

2  Asked on August 2, 2020


Why can’t I type a g̃ the same way I type ñ?

1  Asked on July 29, 2020 by mmaluff


Custom logrotate with hostnames

0  Asked on July 29, 2020 by gwynn


Ask a Question

Get help from others!

© 2021 All rights reserved.