rstan icon indicating copy to clipboard operation
rstan copied to clipboard

RStudio lagging due to stan files

Open MaverickMeerkat opened this issue 4 years ago • 8 comments

I have a pretty good computer, and am having a lot of problems using the Stan framework. 1st installation wasn't easy at all. But worse - even though I got it to work - it just super slow. RStudio lags whenever I open a stan file. I cannot save scripts some of the time. When I call the fit function, it literally waits for no good reason for about 2 minutes, and only then runs the chains - and I'm talking about the easy examples in the YouTube official channel...

I decided to uninstall this. Hope you guys improve for the future.

MaverickMeerkat avatar May 29 '21 08:05 MaverickMeerkat

Sorry to hear that you've been having issues. What issues did you encounter when installing? Are there changes to the installation instructions that would have been helpful for you?

As for the rstudio slowdown when opening files, I would recommend opening an issue on the RStudio github: https://github.com/rstudio/rstudio so that they can get that fixed

andrjohns avatar May 29 '21 10:05 andrjohns

In RStudio try turning off some of the diagnostics under Preferences | Code | Diagnostics, especially those not related to R. See if that helps?

ssp3nc3r avatar May 29 '21 12:05 ssp3nc3r

( Just to second, recently Rstudio and stan became quite incompatible. If I am debugging a function and create a stan model (of save) from a file more than 3 times Rstudio needs to be restarted. ) I will try to apply suggestion and report back.

stemangiola avatar May 30 '21 01:05 stemangiola

There's some issues on rstudio's github related to this. If you update rstudio to one of the nightly builds (I'm not sure if the fix is in the most recent release) the problem seems to at least lessen

https://github.com/rstudio/rstudio/issues/9055

SteveBronder avatar Jun 03 '21 21:06 SteveBronder

I have a pretty good computer, and am having a lot of problems using the Stan framework. 1st installation wasn't easy at all. But worse - even though I got it to work - it just super slow. RStudio lags whenever I open a stan file. I cannot save scripts some of the time. When I call the fit function, it literally waits for no good reason for about 2 minutes, and only then runs the chains - and I'm talking about the easy examples in the YouTube official channel...

I decided to uninstall this. Hope you guys improve for the future.

Sorry to hear that. I learnt Stan 1.5 years ago and used both rstan and cmdstanr on Win10 and Linux. I have similar issues like yours on Rstudio but it is not due to Stan, if you use a plain text editor to modify and write Stan model and only compile and fit in Rstudio, you will not have lagging issue at all. Or maybe use Atom for coding and run in base R or terminal.

zhengchencai avatar Jun 05 '21 12:06 zhengchencai

There's some issues on rstudio's github related to this.

rstudio/rstudio#9055

Just to echo @SteveBronder, I'm a longtime Stan user on Windows and ran into this issue a few months ago, to the point that RStudio became almost unusable when working with Stan files. The solution in the linked issue of doing rstan_options(javascript=FALSE) fixed it 100% in my case. I added that to my .Rprofile and the problem hasn't come back.

ebuhle avatar Jun 05 '21 17:06 ebuhle

I am have some extreme problems using Ratudio to edit Stan files and then use Rstudio to run my code. My M2 MacBook Pro was running RStudio just fine with r code and Stan files but since the beginning of September saving, editing, running code, anything becomes extremely slow when I have a Stan file open in RStudio. I have tried uninstalling R and RStudio. I have tried older versions of both. I have updated to the most current version of the rstan library. I even reinstalled my OS to see if that fixes the problem. Nothing is working. For example, when I have a Stan file open to edit my model, it takes a few minutes to save changes. Then when I just have the Stan file open, it takes minutes to save r code scripts.

I have looked at this thread and https://github.com/rstudio/rstudio/issues/9055. The javascript FALSE didn't work for me, I tried using the experimental versions of the stanheaders and Rstan and that has helped it seems but then when I open R studio I get the error message:

Loading required namespace: V8 Failed with error: 'there is no package called 'V8'' SyntaxError: invalid regular expression flags at :1

bwavila avatar Sep 27 '23 15:09 bwavila

Failed with error: 'there is no package called 'V8''

Have you tried installing the V8 package?

andrjohns avatar Sep 27 '23 15:09 andrjohns