Hi @stevebronder, thanks for working on this. Any idea when this might be fixed? I’ve tried renaming my Makevars file, and tried installing the 2.2.0 version of withr (certainly could have incorrectly done either of these steps), but still getting this error. Thanks!
Nevermind- was able to get this by reinstalling stan from CRAN and then reinstalling withr v.2.2.0. And, thanks @stevebronder for the work you do to support stan!
@Caroline_King sorry for the inconvenience, but glad it’s working now!
Hi, I am trying to install older versions of withr but either I do it with this command or from CRAN I get the following message : Error: ‘\R’ is an unrecognized escape in character string starting "“C:\R”
Why does it occur? Any suggestion?
Thanks for the solution. It worked for me, however, there is still this warning, it’s funny shouldn’t it be mingw_64 rather than mingw_? Could you please help.
Warning messages: 1: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) : 'C:/rtools40/usr/mingw_/bin/g++' not found
I’m running rstan 2.21.2 (CRAN version) in R 4.0.3 on Windows and I got the error described in this thread. Rolling back to withr 2.2.0 fixed it, but now I have a different problem. When I call
stan_model(), not only does the resulting model not use the flags in my
Makevars.win, but the
Makevars.win file is actually deleted. I’ve tried restoring it, but it gets deleted again every time.
I’m wondering if this behavior is somehow related to this:
I don’t have
-march=native in my Makevars. Based on this advice, it looks like:
CXX14FLAGS = -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2
get_cxxflags() on the stanmodel returns:
CXXFLAGS = -O2 -Wall $(DEBUGFLAG) -mfpmath=sse -msse2 -mstackrealign
Any idea what’s going on and how to fix it?
Sorry if this issue has been covered somewhere; I’m a little lost with all the R 4.0-related threads. Thanks in advance!
Sorry that your having this issue, your saying it completely deletes the file? I’m waiting for the below to get merged which should hopefully fix this issue
Yep, it completely deletes
Makevars.win. If I call
stan() instead of
stan_model(), it doesn’t delete the file but
get_cxxflags() still returns the same defaults I showed above, rather than the contents of
Makevars.win. It’s not fatal, but obviously I’d prefer the
stanmodel to be optimized for speed.
I actually just perused that PR. If you could let us know in this thread when it’s merged, that would be swell. Thanks for working on this, and for such a rapid reply!
This tip “remotes::install_version(“withr”, “2.2.0”)” helped me install rstan correctly after spending hours trying to reinstall and install packages! Amazing and thank you so much!
Sorry it was such a hassle but I’m glad to hear it’s working now!
@andrjohns @stevebronder Does this solution people are using result in many people having Stan run a lot slower that it can (e.g., because Makevars had
-O3 etc.)? Checking on this because it was just reported again on github and the person solved it using this method.
Is this still an issue with the latest version on github? I merged a PR that should have fixed this
Yeah it will run slower because we are missing
Probably fixed on github installing from source but there hasn’t been a release in a while so people installing the latest CRAN release are still encountering this.
@stevebronder So I guess the best option for now is encouraging people to keep their makevars but install from github?
Yeah I think so, would it be possible to have a bugfix release of rstan for this?
That would be a good idea. @bgoodri?
I guess this is a bit of an old issue - but just confirming that I had this error, and the above fix (file.rename etc…) WORKED for me too.
Thanks for letting us know. Glad that fixed it for you.
While that fix will work, your models will run slower (since they’re no longer being optimised by the compiler).
Instead, if you follow the instructions here: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows#makevars-configuration
You’ll get the optimisations working. You just need to make sure that you don’t update the
withr package after doing so
I don’t know why, but my Makevars.win looks like this:
CXX14FLAGS=-O3 -Wno-unused-variable -Wno-unused-function CXX14 = $(BINPREF)g++ -m$(WIN) -std=c++1y CXX11FLAGS=-O3 -Wno-unused-variable -Wno-unused-function
Since this configuration worked well in the past, I decided to go back to withr 2.2.0.