Package installation failure

Hi Everyone,

I'm trying to install a couple of packages in RStudio v1.2.1335 on Ubuntu 18 but they are installing into a /tmp/ directory no matter how many times I restart RStudio session.

'The downloaded source packages are in
‘/tmp/RtmpgnRuCy/downloaded_packages’

Is there a way to ensure these packages install properly instead of using the various workarounds made on the net. I don't get the problem on Windows R12 server for some reason. Perhaps I should ask whether there is a preferred method to resolve the issue.

install.packages(c("leaflet", "leaflet.extras", "rgdal", "rpostgis"))
Installing packages into ‘/home/paul/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘png’, ‘rgeos’

trying URL 'https://cloud.r-project.org/src/contrib/png_0.1-7.tar.gz'
Content type 'application/x-gzip' length 24990 bytes (24 KB)
==================================================
downloaded 24 KB

trying URL 'https://cloud.r-project.org/src/contrib/rgeos_0.4-2.tar.gz'
Content type 'application/x-gzip' length 255244 bytes (249 KB)
==================================================
downloaded 249 KB

trying URL 'https://cloud.r-project.org/src/contrib/leaflet_2.0.2.tar.gz'
Content type 'application/x-gzip' length 2059752 bytes (2.0 MB)
==================================================
downloaded 2.0 MB

trying URL 'https://cloud.r-project.org/src/contrib/leaflet.extras_1.0.0.tar.gz'
Content type 'application/x-gzip' length 1828592 bytes (1.7 MB)
==================================================
downloaded 1.7 MB

trying URL 'https://cloud.r-project.org/src/contrib/rgdal_1.4-3.tar.gz'
Content type 'application/x-gzip' length 1687331 bytes (1.6 MB)
==================================================
downloaded 1.6 MB

trying URL 'https://cloud.r-project.org/src/contrib/rpostgis_1.4.2.tar.gz'
Content type 'application/x-gzip' length 86841 bytes (84 KB)
==================================================
downloaded 84 KB

* installing *source* package ‘png’ ...
** package ‘png’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      `libpng-config --cflags` -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c read.c -o read.o
/bin/bash: libpng-config: command not found
read.c:3:10: fatal error: png.h: No such file or directory
 #include <png.h>
          ^~~~~~~
compilation terminated.
/usr/lib/R/etc/Makeconf:159: recipe for target 'read.o' failed
make: *** [read.o] Error 1
ERROR: compilation failed for package ‘png’
* removing ‘/home/paul/R/x86_64-pc-linux-gnu-library/3.4/png’
Warning in install.packages :
  installation of package ‘png’ had non-zero exit status
* installing *source* package ‘rgeos’ ...
** package ‘rgeos’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgeos: 0.4-2
checking for /usr/bin/svnversion... no
configure: svn revision: 581
checking for geos-config... no
no
configure: error: geos-config not found or not executable.
ERROR: configuration failed for package ‘rgeos’
* removing ‘/home/paul/R/x86_64-pc-linux-gnu-library/3.4/rgeos’
Warning in install.packages :
  installation of package ‘rgeos’ had non-zero exit status
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: R_HOME: /usr/lib/R
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: C++11 support available
configure: rgdal: 1.4-3
checking for /usr/bin/svnversion... no
configure: svn revision: 828
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/home/paul/R/x86_64-pc-linux-gnu-library/3.4/rgdal’
Warning in install.packages :
  installation of package ‘rgdal’ had non-zero exit status
ERROR: dependency ‘png’ is not available for package ‘leaflet’
* removing ‘/home/paul/R/x86_64-pc-linux-gnu-library/3.4/leaflet’
Warning in install.packages :
  installation of package ‘leaflet’ had non-zero exit status
ERROR: dependency ‘rgeos’ is not available for package ‘rpostgis’
* removing ‘/home/paul/R/x86_64-pc-linux-gnu-library/3.4/rpostgis’
Warning in install.packages :
  installation of package ‘rpostgis’ had non-zero exit status
ERROR: dependency ‘leaflet’ is not available for package ‘leaflet.extras’
* removing ‘/home/paul/R/x86_64-pc-linux-gnu-library/3.4/leaflet.extras’
Warning in install.packages :
  installation of package ‘leaflet.extras’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpgnRuCy/downloaded_packages’

They are not getting installed at all, you are missing several system dependencies, I think you need to try solving one at a time, for installing leaflet, for example, you are missing the png package dependency and the installation is failing because you need to install this library from a system terminal first.

sudo apt install libpng-dev

Then you can ttry installing the package again

install.packages("leaflet")

/tmp is where failed compilation source files go for burial. the ERROR messages explain why. In each case your Ubuntu installation is missing one or more C/C++ libraries.

Check https://www.r-bloggers.com/installation-of-r-3-5-on-ubuntu-18-04-lts-and-tips-for-spatial-packages/ for an explanation and detailed instructions.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.