stan-dev / stan-dev/rstan

Environment checks in system progress preperation throws error in Positron

Open
#1,149 5 comments 13 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

Hi stan-dev!

I have been trying out the new IDE from Posit, Positron, and have been really loving it. However, when I run a parallelized stan model (by specifying cores in the call to a brms model for example), rstan opens up a port in my browser with the following error message:

Cannot GET /var/folders/lm/4jkt0_jd37j4c_68xmrxp7f00000gn/T//Rtmpp3I1Pz/file5568b9aee29_StanProgress.txt

This behavior is OS agnostic and only applies to the case when a user runs chains in parallel as in:

library(brms)

# This runs without issue
brms::brm(
  mpg ~ hp * cyl, 
  data = mtcars)

# This opens the browser tab
m_mpg = brm(
  mpg ~ hp * cyl, 
  data = mtcars,
chains=4, cores=4)

For reference, see my issue on Positron's repo here.

In it, @juliasilge points out that this behavior is likely a result of rstan's environment checks with Sys.getenv("RSTUDIO"). See the code below, which would not be set to 1 for users working in Positron. Is it possible to generalize these checks a bit to include Positron, @juliasilge provides an example of what she thinks this might look like (linked above).

https://github.com/stan-dev/rstan/blob/9b8d8fe715f1d51063621e6ca01d6265b02356fe/rstan/rstan/R/stanmodel-class.R#L517

I am happy to take a swing at implementing this if helpful, as well.

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 in rstan/rstan/R/stanmodel-class.R around line 517, where the environment checks referenced in the issue inspect RSTUDIO. Reproduce the parallel brms example in Positron and compare it with a regular RStudio run. Done means the Positron run no longer opens a browser tab with the StanProgress.txt error while existing parallel behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.