R install 'png' unable to load shared object

Viewed 924

When I run install.packages("png"), no matter if I do it within R Studio or as super user from the terminal on my Mac, I receive the following error. I have had no success implementing other solutions for this problem. I am using R 4.0.2 (upgraded from 3.6.3 because that didn't work either). The only solution I have currently is to use my university's virtual desktop R distro, as it works in that. However, it's slow and just not the same.

    ** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘png’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/bryce/Library/R/4.0/library/00LOCK-png/00new/png/libs/png.so':
  dlopen(/Users/bryce/Library/R/4.0/library/00LOCK-png/00new/png/libs/png.so, 6): Library not loaded: @rpath/libz.1.dylib
  Referenced from: /Users/bryce/Library/R/4.0/library/00LOCK-png/00new/png/libs/png.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/bryce/Library/R/4.0/library/png’
Warning in install.packages :
  installation of package ‘png’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/qd/q49j7g891jn7t368990fflrw0000gn/T/RtmpPhRir5/downloaded_packages’

I have tried resolving the problem by reinstalling libpng via homebrew, as well as reinitializing the symlinks, but I've hit a dead end.

2 Answers

SOLVED: Workaround found. Had to purge RStudio and download R before re-downloading RStudio. Seems to have fixed the problem.

Kinda late to the party here, but this issue still exists when trying to install clusterProfiler on M1 Mac.

What fixed it was to install bioconductor and then clusterProfiler in an R session in the terminal and then load the library from Rstudio.

Related