Search code examples
rstudio-serverrgdalopencpu

Install rgdal in rstudio-server through Docker


I am using the opencpu/rstudio docker image. Docker runs through a Virtual Machine because I am a Windows user. After running rstudio-server, I try to install my R package from github. Everything works fine, until rgdal should be installed.

I get the following error message:

Installing rgdal
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --
quiet  \
CMD INSTALL '/tmp/RtmpJvVTTU/devtools2c362554e5/rgdal'  \
--library='/usr/local/lib/opencpu/site-library' --install-tests 

* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgdal: 1.2-16
checking for /usr/bin/svnversion... no
configure: svn revision: 701
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/usr/local/lib/opencpu/site-library/rgdal’
Installation failed: Command failed (1)
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --
 quiet  \
CMD INSTALL  \
'/tmp/RtmpJvVTTU/devtools2cd1cfd76/amun-software-Processingservice-6db3f06'  
 \
--library='/usr/local/lib/opencpu/site-library' --install-tests 

How could I solve this?


Solution

  • There are some missing libraries.

    If you log in to the shell of the Docker container as follows...

    docker exec -it <your docker container name> bash
    

    you can install the missing dependencies...

    sudo apt-get update && sudo apt-get install libgdal-dev libproj-dev
    

    Exit the shell and from RStudio do...

    install.packages("rgdal")