在Docker中安装Rcpp软件包会导致安装过程冻结 [英] Installing the Rcpp package in Docker leads to a freeze during the installation

查看:79
本文介绍了在Docker中安装Rcpp软件包会导致安装过程冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在安装R Shiny应用程序,但现在无法运行安装.

I am installing an R Shiny app, but I am not able to run the installation anymore.

这是我的 Dockerfile

FROM openanalytics/r-base

# system libraries of general use
RUN apt-get update && apt-get install -y \
    sudo \
    pandoc \
    pandoc-citeproc \
    libcurl4-gnutls-dev \
    libcairo2-dev \
    libxt-dev \
    libssl-dev \
    libssh2-1-dev \
    libssl1.0.0

# system library dependency for the app
RUN apt-get update && apt-get install -y \
    libxml2-dev

RUN R -e "install.packages(c('data.table','janitor','snakecase'), repos='https://cloud.r-project.org/')"

RUN R -e "install.packages('https://cran.r-project.org/src/contrib/Archive/dplyr/dplyr_0.8.2.tar.gz', repos=NULL, type='source')"
RUN R -e "install.packages('https://cran.r-project.org/src/contrib/Archive/shiny/shiny_1.3.0.tar.gz', repos=NULL, type='source')"

# copy the app to the image
RUN mkdir /root/corona
COPY app /root/corona

COPY Rprofile.site /usr/lib/R/etc/

EXPOSE 3838

CMD ["R", "-e shiny::runApp('/root/corona', options = list(port = '3838'))"]

构建图像只是冻结,总是在这一行:

Building the image just freezes, always on this line:

* installing *source* package ‘R6’ ...
** package ‘R6’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (R6)
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-ttHamR/r-base-4.0.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c api.cpp -o api.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include/     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-ttHamR/r-base-4.0.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c attributes.cpp -o attributes.o

有类似的问题并且可以告诉我为什么会发生这种情况的人吗?

Anyone who similar issue and can tell me why this happens?

我试图从源代码安装该软件包,尝试了另一个版本,但始终是相同的.这是与Docker相关还是与软件包相关的问题?

I tried to install the package from source, tried another version, but it is always the same. It this a Docker related or package related problem?

还尝试从那里安装它: install.packages("Rcpp",repos ="https://rcppcore.github.io/drat")

Also tried to install it from there: install.packages("Rcpp", repos="https://rcppcore.github.io/drat")

推荐答案

如果确实失败,则可能是内存太少.我通常只是提交我的Dockerfile,并让hub.docker.com构建它们,但是我也经常在本地测试新的或变体,并且它们构建良好.如果您使用的是低功率云实例:Rcpp是C ++,确实需要编译器提供一些RAM.因此,请勿尝试使用最便宜的1核512 mb RAM.

If the compilation really fails, you may have too little RAM. I most often just commit my Dockerfiles and let hub.docker.com build them, but I also frequently test new ones or variations locally and they build just fine. In case you are on an underpowered cloud instance: Rcpp is C++ and does require a bit of RAM from the compiler. So don't try the cheapest 1 core, 512 mb RAM options.

但是您还有其他选择.因为这是一个带有 apt 的系统,所以只需安装更多的CRAN软件包作为预制二进制文件即可: apt-get install r-cran-rcpp r-cran-data.table 等等.

But you also have other options. As this is a system with apt, just install more of the CRAN packages as pre-made binaries: apt-get install r-cran-rcpp r-cran-data.table and so on.

这篇关于在Docker中安装Rcpp软件包会导致安装过程冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆