0

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

This is my 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?

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?

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

Data Mastery
  • 1,555
  • 4
  • 18
  • 60

1 Answers1

3

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.

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.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • wow, how quick you are ;-). Thank you very much. Yes I indeed use a the cheapest and smallest digital ocean machine. I will test your solution. – Data Mastery Aug 30 '20 at 14:47
  • 2
    In particular, try `apt-get install r-cran-dplyr`. That one is expensive to build. I have a (by now somewhat large) number of blog posts showing how you can do _much_ better with binaries. Without hitting the wall. And remaining cheap :) See the posts at http://dirk.eddelbuettel.com/blog/code/r4 – Dirk Eddelbuettel Aug 30 '20 at 14:54
  • thanks for the link. Image was built successfully :-) – Data Mastery Aug 30 '20 at 14:56
  • Sorry for bringing up this old topic but can you share how you altered the Dockerfile so this works @DataMastery? Thank you very much! – Seb Feb 16 '21 at 20:06
  • hey Seb, sorry did not use stackoverflow for a few days. I changed nothing, just upgraded to a machine with a little more RAM – Data Mastery Feb 19 '21 at 19:59