rgdal 不会安装在 docker ubuntu 18.04 "ERROR::command not found"

标签 r linux docker ubuntu rgdal

尝试为 Shiny 的应用程序和 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包裹。

关于rgdal 不会安装在 docker ubuntu 18.04 "ERROR::command not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65123790/

相关文章:

r - 将向量与向量列表匹配

r - 使用 :=, 时为什么默认使用 with=TRUE?

linux - 如何遍历 bash 脚本中字符串类型的参数?

c - 如何使用 shift + ctrl 键在 C 中获得完全交互式的 bash 终端?

neo4j - Windows中的Neo4j Mazerunner逐步安装指南

r - 列值的切换功能

r - 如何在R管道中输出两次?

linux - 使用 mkdir 数据 : permission denied 设置后全新安装 gogs panic

docker - 使用 Docker-Compose 和存储选项(大小)

docker - docker-compose-仅通过Vagrant-Windows Shell没有此类服务