通过 Docker 在 rstudio-server 中安装 rgdal

Install rgdal in rstudio-server through Docker

我正在使用 opencpu/rstudio docker 图片。 Docker 通过虚拟机运行,因为我是 Windows 用户。在 运行 rstudio-server 之后,我尝试从 github 安装我的 R 包。一切正常,直到应该安装 rgdal。

我收到以下错误消息:

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 

我该如何解决这个问题?

缺少一些库。

如果如下登录Docker容器的shell...

docker exec -it <your docker container name> bash

您可以安装缺少的依赖项...

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

退出 shell 并从 RStudio 执行...

install.packages("rgdal")