stan-dev / rstan

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

Error: package or namespace load failed for ‘rstan’ #1069

Open connor-morozumi opened 1 year ago

connor-morozumi commented 1 year ago

Summary:

rstan fails to load due to ggplot, unused argument (linewidth = 1)

Description:

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)

I can see this was addressed previously here: https://github.com/stan-dev/rstan/issues/1062 but can't interpret the advice:

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

https://github.com/stan-dev/rstan/issues/1062#issuecomment-1528972475

Reproducible Steps:

I was following the Getting Started Guide

when I tried to verify installation by running the test model example(stan_model, package = "rstan", run.dontrun = TRUE)

library(rstan) causes the same error

Current Output:

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) In addition: Warning message: package ‘rstan’ was built under R version 4.2.3

Expected Output:

RStan Version:

‘2.26.22’

R Version:

"R version 4.2.0 (2022-04-22)"

Operating System:

OS X 12.3.1