R - RGDAL 不会安装在 Docker Ubuntu 18.04 "ERROR:: command not found"



试图为一个闪亮的应用程序和rgdal创建一个docker容器,但安装不正确。

Ubuntu版本:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic

我使用renv的系统https://www.statworx.com/de/blog/how-to-dockerize-shinyapps/

Dockerfile如下所示:

cat Dockerfile
#get the base image
#FROM rocker/shiny:latest
#try with r-ver to make it smaller
FROM rocker/r-ver:latest
# system libraries of general use
## install debian packages
RUN apt-get update -qq && apt-get -y --no-install-recommends install 
libxml2-dev 
libcairo2-dev 
libsqlite3-dev 
libpq-dev 
libssh2-1-dev 
unixodbc-dev 
r-cran-v8 
libv8-dev 
net-tools 
libprotobuf-dev 
protobuf-compiler 
libjq-dev 
libudunits2-0 
libudunits2-dev 
libcurl4-gnutls-dev 
libssl-dev 
#    libhdf4-0 
#    libhdf4-dev 
libhdf5-dev 
gdal-bin libgdal-dev 
#    libgdal27 
proj-bin libproj-dev 
#    libgdal-dev 
#    libgdal20 
libgeos-dev 
libnetcdf-dev
#    libproj-dev
## update system libraries
RUN apt-get update && 
apt-get upgrade -y && 
apt-get clean
# copy necessary files
## renv.lock file
COPY /tfwm-public-dashboard/renv.lock ./renv.lock
# install renv & restore packages
RUN Rscript -e 'install.packages("renv")'
RUN Rscript -e 'renv::restore()'
## app folder
COPY /tfwm-public-dashboard ./app
# expose port
EXPOSE 3838
# run app on container start
CMD ["R", "-e", "shiny::runApp('/tfwm-public-dashboard', host = '0.0.0.0', port = 3838)"]

我已经评论了在安装时发生冲突的依赖项,或者我从其他解决方案中添加了它们,但它们似乎对它没有影响。

在所有其他r包看起来加载良好后,我得到的错误是:

Installing rgdal [1.3-6] ...
Error: install of package 'rgdal' failed
FAILED
Error installing package 'rgdal':
=================================
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
** using staged installation
configure: R_HOME: /usr/local/lib/R
'config' variable 'CPP' is deprecated
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
configure: C++11 support available
configure: rgdal: 1.3-6
checking for /usr/bin/svnversion... no
configure: svn revision: 773
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.0.4
checking GDAL version >= 1.11.4... yes
checking gdal: linking with --libs only... no
checking gdal: linking with --libs and --dep-libs... no
./configure: line 1979: ERROR:: command not found
./configure: line 1994: ERROR:: command not found
configure: Install failure: compilation and/or linkage problems.
configure: error: GDALAllRegister not found in libgdal.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/usr/local/lib/R/site-library/.renv/1/rgdal’
Traceback (most recent calls last):
14: renv::restore()
13: renv_restore_run_actions(project, diff, current, lockfile, rebuild)
12: renv_install(records, library)
11: renv_install_staged(records, library)
10: renv_install_default(records, library)
9: handler(package, renv_install_impl(record))
8: renv_install_impl(record)
7: withCallingHandlers(renv_install_package_local(record), error = function(e) {
vwritef("tFAILED")
writef(e$output)
})
6: renv_install_package_local(record)
5: renv_install_package_local_impl(package, path, library)
4: r_cmd_install(package, path, library)
3: r_exec(package, args, "install")
2: r_exec_error(package, output, label)
1: stop(error)
Execution halted
The command '/bin/sh -c Rscript -e 'renv::restore()'' returned a non-zero code: 1

我已经研究了围绕这个主题的其他问题,但它们似乎没有出现相同的错误。

./configure: line 1979: ERROR:: command not found
./configure: line 1994: ERROR:: command not found

很难确定,但根据输出+相关的配置脚本,C++编译器似乎没有正确设置或启动:

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking gdal: linking with --libs only" >&5
$as_echo_n "checking gdal: linking with --libs only... " >&6; }
${CXX} ${CPPFLAGS} -o gdal_test gdal_test.cc ${LIBS} 2> errors.txt
if test `echo $?` -ne 0 ; then
gdalok=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
if test "${gdalok}" = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking gdal: linking with --libs and --dep-libs" >&5
$as_echo_n "checking gdal: linking with --libs and --dep-libs... " >&6; }
LIBS="${LIBS} ${GDAL_DEP_LIBS}"
gdalok=yes
${CXX} ${CPPFLAGS} -o gdal_test gdal_test.cc ${LIBS} 2>> errors.txt
if test `echo $?` -ne 0 ; then
gdalok=no
fi
if test "${gdalok}" = yes; then
NEED_DEPS=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi

我怀疑${CXX}由于某种原因是空的。您可能需要尝试安装或使用较新版本的rgdal软件包。

修复了

通过浏览摇滚歌手Dockerfiles的其他版本并构建一个组合,主要是从地理空间窃取。以下是允许rgdal安装的docker容器的设置。

FROM rocker/shiny:3.6.3
RUN apt-get update && apt-get install -y 
lbzip2 
libfftw3-dev 
libgdal-dev 
libgeos-dev 
libgsl0-dev 
libgl1-mesa-dev 
libglu1-mesa-dev 
libhdf4-alt-dev 
libhdf5-dev 
libjq-dev 
liblwgeom-dev 
libpq-dev 
libproj-dev 
libprotobuf-dev 
libnetcdf-dev 
libsqlite3-dev 
libssl-dev 
libudunits2-dev 
netcdf-bin 
postgis 
protobuf-compiler 
sqlite3 
tk-dev 
unixodbc-dev 
libssh2-1-dev 
r-cran-v8 
libv8-dev 
net-tools 
libsqlite3-dev 
libxml2-dev

相关内容

  • 没有找到相关文章

最新更新