stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.02k stars 264 forks source link

rstan installation fails due to ggplot2 #1062

Closed cvanhoutte closed 1 year ago

cvanhoutte commented 1 year ago

Summary:

Latest version of Rstan installation fails, with an error related to ggplot2 May be related to this open pull request: https://github.com/stan-dev/rstan/pull/1026

Description:

Here is the error

Error: package or namespace load failed for ‘rstan’:
 .onLoad failed in loadNamespace() for 'rstan', details:
  call: ggplot2::element_line(linewidth = 1)
  error: unused argument (linewidth = 1)
Error: loading failed
Execution halted
ERROR: loading failed

I'm building in a Singularity container using the rocker/r-ver:4.2.1 image, although I'm not sure it's related to the container.

Reproducible Steps:

Here is the singularity file named, which I can build with sudo -E singularity build rstan_latest.sif Singularity, if the text below is in a file called 'Singularity'

#  Singularity Definition for an image
Bootstrap: docker
From: rocker/r-ver:4.2.1

%labels
    Maintainer me
    OWNER me
    Version 0.0.1
%environment
    DOTNET_CLI_TELEMETRY_OPTOUT=1
    export DOTNET_CLI_TELEMETRY_OPTOUT
%post
    apt-get update
    apt-get -y install curl libcurl4-openssl-dev
    apt-get -y install apt-transport-https
    apt-get -y install libssl-dev libxml2-dev
    apt-get -y install zlib1g-dev
    apt-get -y install pandoc
    apt-get -y update && apt-get -y install --no-install-recommends python3 python3-dev python3-pip python3-venv python3-setuptools
    apt-get -y install xdg-utils --fix-missing
    apt-get -y install build-essential libv8-dev

    # configure c++ toolchain
    R -e "dotR <- file.path(Sys.getenv(\"HOME\"), \".R\"); if (!file.exists(dotR)) dir.create(dotR);
            M <- file.path(dotR, \"Makevars\");if (!file.exists(M)) file.create(M);
            cat(\"\nCXX14FLAGS=-O3 -march=native -mtune=native -fPIC\", \"CXX14=g++\", file = M, sep = \"\n\", append = TRUE)"
    R -e "options(repos = list(CRAN = \"https://cran.rstudio.com\")); install.packages(\"renv\")"
    R -e "install.packages(\"renv\")"
    R -e "install.packages(\"rstan\", repos = c(\"https://mc-stan.org/r-packages/\", getOption(\"repos\")))"
    R -e "install.packages('shinystan')"
%runscript
    exec R

Current Output:

Installation failed

RStan Version:

experimental

R Version:

4.2.1 (via rocker/r-ver:4.2.1)

Operating System:

Ubuntu 20.04 (via rocker/r-ver:4.2.1 )

andrjohns commented 1 year ago

The issue is that the r-ver images use a fixed snapshot of the CRAN repos, which in this case are providing ggplot2 3.3.6. The linewidth aesthetic was introduced in 3.4.0, and so the error.

You'll need to use the same command to install ggplot2 that you did for the renv install

connor-morozumi commented 1 year ago

@andrjohns I am getting this same error. Could you explain this further?

You'll need to use the same command to install ggplot2 that you did for the renv install