stan-dev / stan-dev/rstan

Error: package or namespace load failed for ‘rstan’

Open
#1,069 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing library(rstan) and the example(stan_model, package = "rstan", run.dontrun = TRUE) command from the RStan Getting Started Guide. Read the linked issue 1062 alongside the reported RStan, R, and operating-system versions. Done means the installation verification no longer fails with the ggplot2 linewidth error, or the required compatibility guidance is clarified.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.