stan-dev / stan-dev/rstan

`rstan` missing `BH` from imports / suggests

Open Beginner friendly
#1,140 7 comments 1 reaction 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:

It appears that rstan requires the BH to be available at run time when it compiles the Stan models otherwise an error is thrown e.g.

> stan_model <- stan_model(model_code = model)
Error in stan_model(model_code = model) : 
  Boost not found; call install.packages('BH')

However Stan doesn't list BH in it's imports or suggests but instead only in it's LinkingTo field.

From CRAN Writing R Extensions:

Note that ‘LinkingTo’ applies only to installation

This doesn't usually cause an issue as install.packages() includes LinkingTo packages by default however the pak installer takes a more strict view and won't install LinkingTo packages if it is installing binary packages (The logic being they are already compiled so the LinkingTo headers are redundant).

This is currently an issue when trying to use the Rhub pipelines for testing packages as they are dependent on pak for installing dependencies

https://github.com/insightsengineering/rbmi/actions/runs/11362703172/job/31605118630#step:5:1762

I originally raised this with the Rhub developers who suggested that I raise an issue here in order to get the Stan DESCRIPTION file updated to resolve this

https://github.com/r-hub/rhub/issues/642

Reproducible Steps:
  • Install Rstan
  • Remove BH if it was automatically installed
  • Run any Stan model and it will throw an error that BH is missing
Current Output:

NA

Expected Output:

NA

RStan Version:

2.35.0.9000

R Version:

R version 4.4.1 (2024-06-14)

Operating System:

MacOS 14.6.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 inspecting the package DESCRIPTION file and its current LinkingTo entry for BH. Reproduce the failure by installing with pak without BH, then run a Stan model as described in the issue. Done means the dependency declaration causes BH to be available at runtime and the reproduction no longer reports that Boost is missing.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.