Pop-up errors after updating rstanarm and rstan

Hi,

This morning I updated the rstanarm package (through Rstudio, Windows 10). At first things appeared to work normally, but then I started getting annoying pop-up messages that read:

rsession.exe - Entry Point Not Found

The procedure entry point EXTPR_PTR could not be located in the dynamic link library C:\Users\Michael
Schrimpf\Documents\R\win-library\4.0\rstan\libs\x64\rstan.dll.

They appear at odd times, for example, when I click the save button for the script in Rstudio.

I tried reinstalling both RTools40 and rstan, following the instructions I had followed before on:


and
https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-source-on-Windows,
but that didnā€™t solve the problem. Does it have something to do with the fact that my R library is nested under my user folder with a space in the name? (I havenā€™t figured out how to link to my Microsoft account without thatā€¦very annoying).

It seemed like I could still get Stan test models to run by simply hitting OK when the messages come up, but then when I tried loading past stanreg objects I had produced:

# Directory for model output:
mod_dir <- "C:/Docs/model_output"

# Set species
species <- "NAWA"

# Model Results
fit <- readRDS(file = file.path(mod_dir, paste("fit_", species, ".rds", sep = "")))

it first gives me the pop-up again, in addition to these lines:

Warning: namespace ā€˜rstanarmā€™ is not available and has been replaced
by .GlobalEnv when processing object ā€˜<unknown>ā€™
Warning: namespace ā€˜rstanā€™ is not available and has been replaced
by .GlobalEnv when processing object ā€˜<unknown>ā€™

Then it does seem to load the object, but I canā€™t do anything with it. For example:

summary(fit)

Produces:

Error in if (df.r > 0) { : missing value where TRUE/FALSE needed

So, now Iā€™m using:
Windows 10
R 4.0.0
RStudio 1.2.5042
Rstan 2.21.2
rstanarm 2.21.1

I havenā€™t yet tried updating R to 4.0.2 (was hoping to avoid that hassle if possible).

Thanks,
Michael

I havenā€™t seen this error before, but have you updated your R recently?

This thread: https://community.rstudio.com/t/rterm-exe-entry-point-not-found/6544/5 makes me think that this error occurs when a package built in one version of R is used in another.

It sounds like youā€™ve rebuilt Rstan, but maybe itā€™s an Rstan dependency?

I havenā€™t touched my R installation at all since I updated to 4.0 back in spring, and all of my rstan and rstanarm installations were done after that. They were working fine a couple days ago - this only started after I tried updating to the most recent 2.21 versions of the packages today.

I would not be surprised if it simply has to do with a file path somewhere that isnā€™t properly pointing to where itā€™s supposed to, but I simply donā€™t have the skills to diagnose the problem.

(Iā€™m just a biologist with very limited programming experience trying to teach myself how to make the software work) ;)

Iā€™m at a loss too. In a situation like this, since things are already kinda broken, Iā€™d be tempted to go all in and just upgrade everything. Rstudio 1.3 is out, and given the error is happening with rsession.exe (I think thatā€™s an Rstudio thing), that seems worth upgrading.

I realized itā€™s a two part question too and I missed the second part:

@jonah if a model has been saved using saveRDS with one version of rstan can it be loaded in a new version?

Sorry youā€™re getting these weird errors.

That does sound annoying! I havenā€™t seen these errors before. Very strange.

I know thatā€™s been an issue for some RStan users, but Iā€™m not sure if thatā€™s the problem in this case. It could be.

Iā€™m not sure if it would help, but I donā€™t actually think upgrading from 4.0 to 4.0.2 would be much of a hassle. You shouldnā€™t need to reinstall all packages with a minor/patch version increase. (Upgrading from 3.x to 4.x definitely was a hassle!)

Yeah, I think so. At least I donā€™t see why not.

These errors that @mbschrimpf is reporting are super weird though. Iā€™ve never seen them before.

@bgoodri do you have any ideas here?

Ok, update (I think itā€™s progressā€¦)

I updated Rstudio, and then attempted to install rstan and rstanarm again, same issue. But, when I removed them, and then installed from source, rstan installs and no longer gives me the pop-up windows.

Unfortunately it didnā€™t configure correctly, and here I think itā€™s definitely because of that pesky space, because of two reasons. 1) when I try a test model I get this error:

Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  'C:/rtools40/usr/mingw_/bin/g++' not found

And 2) when I try to install rstanarm it fails with this error message:

"C:/rtools40/mingw64/bin/"g++ -m64 -std=c++1y -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I"../inst/include" -I"C:/Users/Michael Schrimpf/Documents/R/win-library/4.0/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I'C:/Users/Michael Schrimpf/Documents/R/win-library/4.0/StanHeaders/include' -I'C:/Users/Michael Schrimpf/Documents/R/win-library/4.0/rstan/include' -I'C:/Users/Michael Schrimpf/Documents/R/win-library/4.0/BH/include' -I'C:/Users/Michael Schrimpf/Documents/R/win-library/4.0/Rcpp/include' -I'C:/Users/Michael Schrimpf/Documents/R/win-library/4.0/RcppEigen/include' -I'C:/Users/Michael Schrimpf/Documents/R/win-library/4.0/RcppParallel/include'     `"C:/PROGRA~1/R/R-40~1.0/bin/x64/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-40~1.0/bin/x64/Rscript" -e "StanHeaders:::CxxFlags()"`   -O3 -march=corei7 -mtune=corei7 -c stan_files/continuous.cc -o stan_files/continuous.o
g++.exe: error: Schrimpf/Documents/R/win-library/4.0/RcppParallel/include": No such file or directory
make: *** [C:/PROGRA~1/R/R-40~1.0/etc/x64/Makeconf:227: stan_files/continuous.o] Error 1
rm stan_files/continuous.cc
ERROR: compilation failed for package 'rstanarm'
* removing 'C:/Users/Michael Schrimpf/Documents/R/win-library/4.0/rstanarm'
Warning in install.packages :
  installation of package ā€˜rstanarmā€™ had non-zero exit status

The line with the g++ error obviously only includes the file path after the space.

My Makevars file was created with the code on this page:
https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-source-on-Windows

and the path that it creates is coded as:

> dotR
[1] "C:\\Users\\Michael Schrimpf\\Documents/.R"

Should I make any edits to Makevars before installing rstan, perhaps?

My next idea is to simply reconfigure R to store packages in a different directory, directly on the C driveā€¦which is probably going to have to be a long-term solution for other things as well. I know thatā€™s possible, I just havenā€™t yet learned how to make Rstudio recognize that path permanently so that I can easily install and load packages without the need to constantly paste in the alternate library path.

-Michael

I think this warning is actually safe to ignore.

This Iā€™m not sure about. It does look like the problem could be the space in the path (I think that issue affects any R package installed from source that requires compilation with RTools).

Yeah should be possible, but I donā€™t know the best way to do that on Windows. @bgoodri @bbbales2 or @rok_cesnovar Do you know how to do this on Windows?

1 Like

Excellent (in a way, at least the weird warning messages went away)!

Yeah moving your install should get rid of the spaces error: Workarounds for current Rstan Windows issues

Hopefully thatā€™s it!

2 Likes

The spaces in path to the R package library is technically an Rstan issue, that can probably be fixed on our end with some quotations in the right places (this is an assumption).

Though I think having the R package library in a path without spaces is in general a good idea, as many packages struggle with it, based on my experience in the past.

@mbschrimpf there are a few guides on moving the library in the link @bbbales2 posted. Others I found useful: Rstudio: Changing the Default Library
https://www.youtube.com/watch?v=2CYKuj8SEPA

Having RTools in a path with spaces is an R issue that the R devs have to address.

1 Like

Oh thatā€™s good to know. I thought this was an issue more generally, but if other R packages work with spaces in the path to the library then RStan should too. @bgoodri do you know how to do this in RStan so we can avoid people getting this error going forward?

Just for the record, today I removed my version of R (which was 4.0.0) and installed version 4.0.2, along with Rstudio and my package library directly on the C drive, avoiding the spaces used by both my user folder and ā€œProgram Filesā€. I also reinstalled rtools40, just to be safe.

I was able to install Rstan from source, and rstanarm from CRAN via the Rstudio UI (I tried installing rstanarm from source first, but it failed for some reason. I didnā€™t take the time to look into it further when it worked the other way).

Both Rstan and rstanarm now run correctly.

Iā€™m not exactly sure which of my remedies fixed the ultimate problem, but it works nowā€¦so Iā€™m happy with that!

Thanks for all of your help :)

2 Likes