Stan not running after updating to r version 4.0.2 and stan updated from 2.19.3 to 2.21

Are people reporting errors on windows with -mtune=native as well? @paul.buerkner you didn’t happen to try -mtune=native without the additional -m* stuff did you?

Thank you very much! I saw that message above and edited the Makevars.win file, but I overlooked the link, and therefore missed the next step.

Appears to be working for me now.

The download in the other thread only works for me with just -mtune=native. I dropped the other things. Specifically a generate quantities model didn’t work.

Still works on Windows 10, R 4 with makevars.win set to:

CXX14FLAGS=-O3 -mtune=native
CXX11FLAGS=-O3 -mtune=native
2 Likes

My makevars.win file is this

CXX14FLAGS += -mtune=native -Wno-ignored-attributes -Wno-deprecated-declarations

CXX14FLAGS=-O3 -mtune=native

CXX11FLAGS=-O3 -mtune=native

CXX14FLAGS=-O3 -mtune=native

CXX11FLAGS=-O3 -mtune=native

The error I get is this

ode, language = language, verbose = verbose) :

Compilation ERROR, function(s)/method(s) not created! g++.exe: error: C:/Program: No such file or directory

g++.exe: error: Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a: No such file or directory

In addition: Warning message:

In file.remove(c(unprocessed, processed)) :

cannot remove file ‘C:\Users\johnson.rd.1\AppData\Local\Temp\2\RtmpopW60L\file230072f67459.stan’, reason ‘No such file or directory’

Error in sink(type = “output”) : invalid connection

image001.png

I am pretty sure that space issue with the path to libStanServices.a has been fixed for a while on

CXX14FLAGS += -mtune=native -Wno-ignored-attributes -Wno-deprecated-declarations

CXX14FLAGS=-O3 -mtune=native

CXX11FLAGS=-O3 -mtune=native

CXX14FLAGS=-O3 -mtune=native -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2

CXX11FLAGS=-O3 -mtune=native

Still getting this error. Nothing I have tried seems to work

Error in compileCode(f, code, language = language, verbose = verbose) :

Compilation ERROR, function(s)/method(s) not created! g++.exe: error: C:/Program: No such file or directory

g++.exe: error: Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a: No such file or directory

image001.png

This is all I have in the makevars.win

CXX14FLAGS=-O3 -mtune=native -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2

CXX11FLAGS=-O3 -mtune=native -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2

Now it appears to be compiling. I had to remove the other junk that was in the file.

Thanks to Paul Buerkner

image001.png

1 Like

Also running into this same error and my rstan program no longer compiling.

OS: Windows 10
Makevars.win is empty
Makevars contains CXX14 = C:/rtools40/mingw64/bin/g++

Had posted about windows 10 and R4.0 troubles earlier noticing issues after upgrade to R4.0. See this post.
.

With which compiler error message?

Thanks @bgoodri! Here console_output.txt (121.9 KB) is a txt file with the console output.

I think this is fixed in rstan 2.21.2.

Hi, all, what’s the latest news on this issue; where can I find the instructions to properly install rstan 2.21.2 on a Windows 10 platform equipped with R version 4.0.2 (2020-06-22)? The point is: the updated instructions at https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started (incl. editing the Makevars.win file) still don’t lead to a successful installation for me. Is there a known workaround you could recommend? Many thanks.

You shouldn’t need a Makevars.win file

Many thanks for the immediate input, Ben @bgoodri. Unfortunately, not generating Makevars.win and Makevars files during the installation process as descibed at https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started does not appear to help either. Here’s the error message I receive after running the fit <- stan(file = “schools.stan”, data = schools_dat) command (sorry, it contains some German):

Fehler in file(con, “r”) : kann Verbindung nicht öffnen
Zusätzlich: Warnmeldungen:
1: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found
2: In system(cmd, intern = !verbose) :
Ausführung von Kommando ‘C:/PROGRA~1/R/R-40~1.2/bin/x64/R CMD SHLIB file25821982b96.cpp 2> file25821982b96.cpp.err.txt’ ergab Status 1
3: In file(con, “r”) :
kann Datei ‘file25821982b96.cpp.err.txt’ nicht öffnen: No such file or directory
Fehler in sink(type = “output”) : ungültige Verbindung

Kind regards.

Hi Henk,

Can I just get some more information about your system? Can you post the outputs from:

Sys.getenv("PATH")
Sys.getenv("BINPREF")
readLines("~/.R/Makevars.win")
readLines("~/.Rprofile")
readLines("~/.Renviron")
devtools::session_info("rstan")

Dear Andrew @andrjohns, thanks for your assistance. As to your query: sure, here we go! (Sorry, it’s a real mess.) Cheers.

Sys.getenv(“PATH”)’
[1] “C:\rtools40\usr\bin;C:\Program Files\R\R-4.0.2\bin\x64;C:\Rtools\bin;c:\Rtools\bin;c:\Rtools\mingw_32\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath_target_268140;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Programme_parcIT\DBMS\IBM\SQLLIB\BIN;C:\Programme_parcIT\DBMS\IBM\SQLLIB\FUNCTION;C:\Programme_parcIT\DBMS\IBM\SQLLIB\samples\repl;C:\Programme_parcIT\DBMS\Sybase\SQL Anywhere 8\win32;C:\Programme_parcIT\DBMS\Sybase\Shared\win32;C:\Programme_parcIT\DBMS\Sybase\SQL Anywhere 8\drivers;C:\Programme_parcIT\DBMS\Sybase\Shared\Sybase Central 4.1;C:\Program Files\Git\cmd;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\Users\heve\AppData\Local\Microsoft\WindowsApps;C:\Users\heve\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;C:\Users\heve\AppData\Local\GitHubDesktop\bin;C:\Users\heve\AppData\Local\Microsoft\WindowsApps;C:\Users\heve\.dotnet\tools”

Sys.getenv(“BINPREF”)
[1] “C:/Rtools/mingw_$(WIN)/bin/”

readLines(“~/.R/Makevars.win”)
Fehler in file(con, “r”) : kann Verbindung nicht öffnen
Zusätzlich: Warnmeldung:
In file(con, “r”) :
kann Datei ‘C:/Anwendungsdaten/heve/.R/Makevars.win’ nicht öffnen: No such file or directory

readLines(“~/.Rprofile”)
[1] “Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")”

readLines(“~/.Renviron”)
[1] “PATH="{RTOOLS40_HOME}\\usr\\bin;{PATH}"”

devtools::session_info(“rstan”)

  • Session info -------------------------------------------------------------------------------------------
    setting value
    version R version 4.0.2 (2020-06-22)
    os Windows 10 x64
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate German_Germany.1252
    ctype German_Germany.1252
    tz Europe/Berlin
    date 2020-09-20

  • Packages -----------------------------------------------------------------------------------------------
    ! package * version date lib source
    assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2)
    backports 1.1.8 2020-06-17 [1] CRAN (R 4.0.2)
    BH 1.72.0-3 2020-01-08 [1] CRAN (R 4.0.0)
    callr 3.4.3 2020-03-28 [1] CRAN (R 4.0.2)
    checkmate 2.0.0 2020-02-06 [1] CRAN (R 4.0.2)
    cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.2)
    colorspace 1.4-1 2019-03-18 [1] CRAN (R 4.0.2)
    crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.2)
    curl 4.3 2019-12-02 [1] CRAN (R 4.0.2)
    desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.2)
    digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.2)
    ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2)
    evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.2)
    fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.2)
    farver 2.0.3 2020-01-16 [1] CRAN (R 4.0.2)
    ggplot2 * 3.3.2 2020-06-19 [1] CRAN (R 4.0.2)
    glue 1.4.1 2020-05-13 [1] CRAN (R 4.0.2)
    gridExtra 2.3 2017-09-09 [1] CRAN (R 4.0.2)
    gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.2)
    inline 0.3.15 2018-05-18 [1] CRAN (R 4.0.2)
    isoband 0.2.2 2020-06-20 [1] CRAN (R 4.0.2)
    jsonlite 1.7.0 2020-06-25 [1] CRAN (R 4.0.2)
    labeling 0.3 2014-08-23 [1] CRAN (R 4.0.0)
    lattice 0.20-41 2020-04-02 [2] CRAN (R 4.0.2)
    lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.2)
    loo 2.3.1 2020-07-14 [1] CRAN (R 4.0.2)
    magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.2)
    MASS 7.3-51.6 [2]
    Matrix 1.2-18 2019-11-27 [1] CRAN (R 4.0.2)
    matrixStats 0.56.0 2020-03-13 [1] CRAN (R 4.0.2)
    mgcv 1.8-31 2019-11-09 [2] CRAN (R 4.0.2)
    munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.2)
    nlme 3.1-148 2020-05-24 [2] CRAN (R 4.0.2)
    pillar 1.4.6 2020-07-10 [1] CRAN (R 4.0.2)
    pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 4.0.2)
    pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.2)
    pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.2)
    praise 1.0.0 2015-08-11 [1] CRAN (R 4.0.2)
    prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.2)
    processx 3.4.3 2020-07-05 [1] CRAN (R 4.0.2)
    ps 1.3.3 2020-05-08 [1] CRAN (R 4.0.2)
    R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.2)
    RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 4.0.0)
    Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.2)
    RcppEigen 0.3.3.7.0 2019-11-16 [1] CRAN (R 4.0.2)
    D RcppParallel 5.0.2 2020-06-24 [1] CRAN (R 4.0.2)
    rlang 0.4.7 2020-07-09 [1] CRAN (R 4.0.2)
    rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.2)
    rstan * 2.21.2 2020-07-27 [1] CRAN (R 4.0.2)
    rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.2)
    scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.2)
    StanHeaders * 2.21.0-5 2020-06-09 [1] CRAN (R 4.0.2)
    testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.2)
    tibble 3.0.3 2020-07-10 [1] CRAN (R 4.0.2)
    utf8 1.1.4 2018-05-24 [1] CRAN (R 4.0.2)
    V8 3.2.0 2020-06-19 [1] CRAN (R 4.0.2)
    vctrs 0.3.2 2020-07-15 [1] CRAN (R 4.0.2)
    viridisLite 0.3.0 2018-02-01 [1] CRAN (R 4.0.2)
    withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.2)

[1] C:/Anwendungsdaten/heve/R/win-library/4.0
[2] C:/Program Files/R/R-4.0.2/library

D – DLL MD5 mismatch, broken installation.

Thanks! So you have two issues here.

First, your BINPREF environment variable is telling R to look for the c++ compiler in the old RTools directory. To fix this, you need to delete the .Rprofile file in your Documents folder and then restart R/RStudio.

Second, your StanHeaders and inline packages are both out of date, and the old versions of these packages can both cause the failures you’re seeing (for different reasons). So you need to update those:

install.packages(c("inline","StanHeaders"))
1 Like

Excellent, Andrew @andrjohns, this did the trick! Stan, here we go again! Only, I get this warning, once the stan() sampling process has been completed:

In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘-E’ not found

Do I need to worry about this?

Great! That warning’s harmless and safe to ignore, will be removed in the next release

2 Likes