简体   繁体   中英

error building docker image: Error: dependency ‘cmdstanr’ is not available

I have a problem building a docker image with the following codes:

FROM rocker/verse:latest
MAINTAINER xxx

RUN apt-get update \
&& apt-get install -y --no-install-recommends apt-utils ed libnlopt-dev libgdal-dev libudunits2-dev cargo jags libcairo2-dev libxt-dev libgeos-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/

# Install rstan
RUN install2.r --error --deps TRUE \
rstan \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds

# Global site-wide config -- neeeded for building packages
RUN mkdir -p $HOME/.R/ \
&& echo "CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -flto -ffat-lto-objects  -Wno-unused-local-typedefs \n" >> $HOME/.R/Makevars

# Config for rstudio user
RUN mkdir -p $HOME/.R/ \
&& echo "CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -flto -ffat-lto-objects  -Wno-unused-local-typedefs -Wno-ignored-attributes -Wno-deprecated-declarations\n" >> $HOME/.R/Makevars \
&& echo "rstan::rstan_options(auto_write = TRUE)\n" >> /home/rstudio/.Rprofile \
&& echo "options(mc.cores = parallel::detectCores())\n" >> /home/rstudio/.Rprofile


RUN Rscript -e "install.packages('cmdstanr', repos = 'http://cran.us.r-project.org', dependencies=TRUE)"

# Install rstan
RUN install2.r --error --deps TRUE \
rstan \
loo \
bayesplot \
rstanarm \
rstantools \
shinystan \
ggmcmc \
tidybayes \
LaplacesDemon \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds

RUN install2.r --error --deps TRUE \
zoo  \
mgcv \
lubridate \
stringr  \
loo \
jsonlite \
scales \
directlabels \
betareg \
extrafont \
pointdensityP \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds

# Install Roboto condensed
RUN wget -O /tmp/rc.zip https://fonts.google.com/download?family=Roboto%20Condensed \
&& cd /usr/share/fonts \
&& sudo mkdir googlefonts \
&& cd googlefonts \
&& sudo unzip -d . /tmp/rc.zip \
&& sudo chmod -R --reference=/usr/share/fonts/truetype /usr/share/fonts/googlefonts \
&& sudo fc-cache -fv \
&& rm -rf /tmp/rc.zip \
&& Rscript --slave --no-save --no-restore-history -e "extrafont::font_import(prompt=FALSE)"

And I failed to build the docker image with the following error:

#10 224.1 Error: dependency 'cmdstanr' is not available------executor failed running [/bin/sh -c install2.r --error --deps TRUE rstan loo bayesplot rstanarm rstantools shinystan ggmcmc tidybayes LaplacesDemon && rm -rf /tmp/downloaded_packages/ /tmp/*.rds]: exit code: 1

Can anyone help me with the issue?

The Getting Started with CmdStanR vi.nette says you should use

install.packages("cmdstanr", 
   repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

you're trying to install it from a CRAN mirror, which won't work because the package isn't on CRAN. (I haven't tested, you might want to install cmdstanr after you install Stan...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM