user189035
user189035

Reputation: 5789

Install package "png" in R/ubuntu

(Under ubuntu), I try:

install.packages("png")

and get:

** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/kaveh/R/x86_64-pc-linux-gnu-library/3.2/png/libs/png.so':
  libpng16.so.16: cannot open shared object file: No such file or directory

I thought it has to due with libpng being obselete but I have already installed it from this link using:

./configure 
make check
make install

so I don't really know what more to do~

Upvotes: 2

Views: 11275

Answers (3)

Abhinav Gupta
Abhinav Gupta

Reputation: 1958

I faced the same problem today. As suggested here, I resolved the problem by first launching R with sudo, and then simply doing install.packages('png').

Upvotes: 8

zihailing
zihailing

Reputation: 1

The key point is here dyn.load(file, DLLpath = DLLpath, ...), it could not find png.so in your DLLpath. DLL are also called 'dynamic shared objects' ('DSO') in Unix-alikes systems. The DLLpath can be added by $LD_LIBRARY_PATH in .bashrc/.bash_profile.

When you install libpng,

./configure prefix=/home/usrname
make check
make install

then add export LD_LIBRARY_PATH=/home/usrname/lib:$LD_LIBRARY_PATH to your .bashrc/.bash_profile I hope I had made it clear.

Upvotes: 0

Dirk is no longer here
Dirk is no longer here

Reputation: 368579

You may be missing the libpng* headers in order to build from source. On my machine(s), I have package libpng12-dev installed. Ensure you have it too, and then try installing png again.

Also note that

R> capabilities()["png"]
 png 
TRUE 
R> 

so your default build of R should already have the ability to create png files.

Upvotes: 4

Related Questions