rstan icon indicating copy to clipboard operation
rstan copied to clipboard

Warning - 'config' variable 'CPP' is deprecated

Open hhau opened this issue 3 years ago • 9 comments

Summary:

After encountering #774 and installing this version of rstan I get a 'config' variable 'CPP' is deprecated warning message / error. I think this is happening here. It looks like this was depreciated in R 3.6.2: https://cran.r-project.org/bin/windows/base/old/3.6.2/NEWS.R-3.6.2.html

Everything Stan related still works as it should, but it makes some of my package's tests fail.

Reproducible Steps:

library(rstan)

res <- stan_model(
  model_code = "data {} parameters {real x;} model {x ~ std_normal();}"
)

gives :

 'config' variable 'CPP' is deprecated
clang -mmacosx-version-min=10.13 -E
Warning message:
In system(paste(CPP, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  error in running command

RStan Version:

‘2.21.3’, 27a744a

R Version:

"R version 4.0.3 (2020-10-10)"

Operating System:

OS X 10.15.7

clang info

$ clang --version
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

hhau avatar Oct 21 '20 13:10 hhau

Thanks for reporting this. If that's deprecated we should remove it. I don't really know anything about this so tagging @bgoodri in case he hasn't seen this yet.

As for the failing tests, @hhau do you know why this is causing a failure if Stan ends up running properly despite the warning? Are the tests set up to fail if there are any warnings at all? I thought tests should pass with warnings unless you use something like testthat::expect_silent(). Anyway, I'm just curious. We should definitely fix the problem regardless.

jgabry avatar Oct 23 '20 22:10 jgabry

I thought tests should pass with warnings unless you use something like testthat::expect_silent()

Yes, you are correct and this is what happens (Apologies, my earlier comment was wrong).

> devtools::test()
Loading wsre
Loading required package: wsre
Testing wsre
✔ |  OK F W S | Context
✔ |   5       | evaluate function [1.1 s]
✔ |   3       | naive ratio estimate 
✔ |   2       | povertygap model can be run without errors [19.9 s]
✔ |   4       | weighted ratio estimate [0.2 s]
⠙ |   2       | wsre method'config' variable 'CPP' is deprecated
clang -mmacosx-version-min=10.13 -E
✔ |   6   1   | wsre function [33.3 s]
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
test_wsre-main.R:58: warning: Passing in stanmodel, with correct data block, leads to wsre_obj
error in running command
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

══ Results ═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 54.6 s

OK:       20
Failed:   0
Warnings: 1
Skipped:  0

hhau avatar Oct 26 '20 09:10 hhau

Glad the tests aren't failing, but thanks for letting us know about this warning.

jgabry avatar Oct 27 '20 00:10 jgabry

@bgoodri Just following up here to say that with the latest 2.21.3 from github I'm also seeing the same warning @hhau reported:

'config' variable 'CPP' is deprecated
clang -mmacosx-version-min=10.13 -E

and then

Warning messages:
1: In system(paste(CPP, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  error in running command

None of these prevent it from running but it would be good to clean them up for the next release.

jgabry avatar Dec 01 '20 23:12 jgabry

Also experiencing this since updating to Big Sur 11.2 and R 4.0.3, rstan 2.21.3

Clang version:

$ clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Screenshot 2021-02-07 at 20 21 07

jpkrooney avatar Feb 07 '21 19:02 jpkrooney

It is a relatively new R development. We'll deal with it.

On Sun, Feb 7, 2021 at 2:25 PM jpkrooney [email protected] wrote:

Also experiencing this since updating to Big Sur 11.2 and R 4.0.3, rstan 2.21.3

Clang version:

$ clang --version Apple clang version 12.0.0 (clang-1200.0.32.29) Target: x86_64-apple-darwin20.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

[image: Screenshot 2021-02-07 at 20 21 07] https://user-images.githubusercontent.com/41968663/107157018-06761900-6982-11eb-8212-7cdf7f4dfbcc.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstan/issues/862#issuecomment-774742122, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ2XKUYN2KQAAKGM5LQNIDS53SI3ANCNFSM4SZYGNIQ .

bgoodri avatar Feb 07 '21 19:02 bgoodri

After updating to the latest R version, this now works. But I'll keep the post here, in case someone else with the older R version is experiencing the same error.

I originally got both the "clang -mmacosx-version-min=10.13 -E" warning and the unserialize error, even with the most recent rstan version:

Compiling Stan program...
'config' variable 'CPP' is deprecated
clang -mmacosx-version-min=10.13 -E
Start sampling
starting worker pid=6764 on localhost:11209 at 13:37:42.657
starting worker pid=6778 on localhost:11209 at 13:37:42.928
starting worker pid=6792 on localhost:11209 at 13:37:43.197
starting worker pid=6806 on localhost:11209 at 13:37:43.471

SAMPLING FOR MODEL 'a379d9db763198ccb913a700062bad2e' NOW (CHAIN 1).

SAMPLING FOR MODEL 'a379d9db763198ccb913a700062bad2e' NOW (CHAIN 2).

SAMPLING FOR MODEL 'a379d9db763198ccb913a700062bad2e' NOW (CHAIN 3).
Error in unserialize(socklist[[n]]) : error reading from connection
In addition: Warning message:
In system(paste(CPP, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  error in running command
Called from: unserialize(socklist[[n]])

Even with:

─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.5 (2021-03-31)
 os       macOS High Sierra 10.13.6   
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Denver              
 date     2021-06-12                  

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package        * version     date       lib source                             
 abind            1.4-5       2016-07-21 [1] CRAN (R 4.0.2)                     
 arrayhelpers     1.1-0       2020-02-04 [1] CRAN (R 4.0.2)                     
 assertthat     * 0.2.1       2019-03-21 [1] CRAN (R 4.0.2)                     
 backports        1.2.1       2020-12-09 [1] CRAN (R 4.0.2)                     
 base64enc        0.1-3       2015-07-28 [1] CRAN (R 4.0.2)                     
 bayesplot        1.8.0       2021-01-10 [1] CRAN (R 4.0.2)                     
 bayestestR       0.10.0      2021-05-31 [1] CRAN (R 4.0.2)                     
 boot             1.3-28      2021-05-03 [1] CRAN (R 4.0.2)                     
 bridgesampling   1.1-2       2021-04-16 [1] CRAN (R 4.0.2)                     
 brms           * 2.15.9      2021-06-12 [1] Github (paul-buerkner/brms@ffe2673)
 Brobdingnag      1.2-6       2018-08-13 [1] CRAN (R 4.0.2)                     
 broom          * 0.7.6       2021-04-05 [1] CRAN (R 4.0.2)                     
 cachem           1.0.5       2021-05-15 [1] CRAN (R 4.0.2)                     
 callr            3.7.0       2021-04-20 [1] CRAN (R 4.0.2)                     
 cellranger       1.1.0       2016-07-27 [1] CRAN (R 4.0.2)                     
 cli              2.5.0       2021-04-26 [1] CRAN (R 4.0.2)                     
 coda             0.19-4      2020-09-30 [1] CRAN (R 4.0.2)                     
 codetools        0.2-18      2020-11-04 [1] CRAN (R 4.0.5)                     
 colorspace       2.0-1       2021-05-04 [1] CRAN (R 4.0.2)                     
 colourpicker     1.1.0       2020-09-14 [1] CRAN (R 4.0.2)                     
 cowplot          1.1.1       2020-12-30 [1] CRAN (R 4.0.2)                     
 crayon           1.4.1       2021-02-08 [1] CRAN (R 4.0.2)                     
 crosstalk        1.1.1       2021-01-12 [1] CRAN (R 4.0.2)                     
 curl             4.3.1       2021-04-30 [1] CRAN (R 4.0.5)                     
 DBI              1.1.1       2021-01-15 [1] CRAN (R 4.0.2)                     
 dbplyr           2.1.1       2021-04-06 [1] CRAN (R 4.0.2)                     
 desc             1.3.0       2021-03-05 [1] CRAN (R 4.0.2)                     
 devtools       * 2.4.2       2021-06-07 [1] CRAN (R 4.0.2)                     
 digest           0.6.27      2020-10-24 [1] CRAN (R 4.0.2)                     
 distributional   0.2.2       2021-02-02 [1] CRAN (R 4.0.2)                     
 dplyr          * 1.0.6       2021-05-05 [1] CRAN (R 4.0.2)                     
 DT               0.18        2021-04-14 [1] CRAN (R 4.0.2)                     
 dygraphs         1.1.1.6     2018-07-11 [1] CRAN (R 4.0.2)                     
 ellipsis         0.3.2       2021-04-29 [1] CRAN (R 4.0.5)                     
 emmeans          1.6.1       2021-06-01 [1] CRAN (R 4.0.2)                     
 estimability     1.3         2018-02-11 [1] CRAN (R 4.0.2)                     
 fansi            0.5.0       2021-05-25 [1] CRAN (R 4.0.5)                     
 farver           2.1.0       2021-02-28 [1] CRAN (R 4.0.2)                     
 fastmap          1.1.0       2021-01-25 [1] CRAN (R 4.0.2)                     
 forcats        * 0.5.1       2021-01-27 [1] CRAN (R 4.0.2)                     
 fs               1.5.0       2020-07-31 [1] CRAN (R 4.0.2)                     
 gamm4            0.2-6       2020-04-03 [1] CRAN (R 4.0.2)                     
 generics         0.1.0       2020-10-31 [1] CRAN (R 4.0.2)                     
 ggdist           2.4.1       2021-06-10 [1] CRAN (R 4.0.5)                     
 ggplot2        * 3.3.3       2020-12-30 [1] CRAN (R 4.0.2)                     
 ggridges         0.5.3       2021-01-08 [1] CRAN (R 4.0.2)                     
 glue             1.4.2       2020-08-27 [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)                     
 gtools           3.9.2       2021-06-06 [1] CRAN (R 4.0.2)                     
 haven            2.4.1       2021-04-23 [1] CRAN (R 4.0.2)                     
 hms              1.1.0       2021-05-17 [1] CRAN (R 4.0.2)                     
 htmltools        0.5.1.1     2021-01-22 [1] CRAN (R 4.0.2)                     
 htmlwidgets      1.5.3       2020-12-10 [1] CRAN (R 4.0.2)                     
 httpuv           1.6.1       2021-05-07 [1] CRAN (R 4.0.2)                     
 httr             1.4.2       2020-07-20 [1] CRAN (R 4.0.2)                     
 igraph           1.2.6       2020-10-06 [1] CRAN (R 4.0.2)                     
 inline           0.3.19      2021-05-31 [1] CRAN (R 4.0.2)                     
 insight          0.14.1      2021-05-28 [1] CRAN (R 4.0.5)                     
 jsonlite         1.7.2       2020-12-09 [1] CRAN (R 4.0.2)                     
 later            1.2.0       2021-04-23 [1] CRAN (R 4.0.2)                     
 lattice          0.20-44     2021-05-02 [1] CRAN (R 4.0.2)                     
 lifecycle        1.0.0       2021-02-15 [1] CRAN (R 4.0.2)                     
 lme4             1.1-27      2021-05-15 [1] CRAN (R 4.0.2)                     
 loo              2.4.1.9000  2021-06-11 [1] Github (stan-dev/loo@0117858)      
 lubridate        1.7.10      2021-02-26 [1] CRAN (R 4.0.2)                     
 magrittr       * 2.0.1       2020-11-17 [1] CRAN (R 4.0.2)                     
 markdown         1.1         2019-08-07 [1] CRAN (R 4.0.2)                     
 MASS             7.3-54      2021-05-03 [1] CRAN (R 4.0.2)                     
 Matrix           1.3-4       2021-06-01 [1] CRAN (R 4.0.2)                     
 matrixStats      0.59.0      2021-06-01 [1] CRAN (R 4.0.2)                     
 memoise          2.0.0       2021-01-26 [1] CRAN (R 4.0.2)                     
 mgcv             1.8-36      2021-06-01 [1] CRAN (R 4.0.2)                     
 mime             0.10        2021-02-13 [1] CRAN (R 4.0.2)                     
 miniUI           0.1.1.1     2018-05-18 [1] CRAN (R 4.0.2)                     
 minqa            1.2.4       2014-10-09 [1] CRAN (R 4.0.2)                     
 modelr           0.1.8       2020-05-19 [1] CRAN (R 4.0.2)                     
 multcomp         1.4-17      2021-04-29 [1] CRAN (R 4.0.5)                     
 munsell          0.5.0       2018-06-12 [1] CRAN (R 4.0.2)                     
 mvtnorm          1.1-2       2021-06-07 [1] CRAN (R 4.0.2)                     
 nlme             3.1-152     2021-02-04 [1] CRAN (R 4.0.5)                     
 nloptr           1.2.2.2     2020-07-02 [1] CRAN (R 4.0.2)                     
 parameters       0.14.0      2021-05-29 [1] CRAN (R 4.0.2)                     
 pillar           1.6.1       2021-05-16 [1] CRAN (R 4.0.2)                     
 pkgbuild         1.2.0       2020-12-15 [1] CRAN (R 4.0.2)                     
 pkgconfig        2.0.3       2019-09-22 [1] CRAN (R 4.0.2)                     
 pkgload          1.2.1       2021-04-06 [1] CRAN (R 4.0.2)                     
 plyr             1.8.6       2020-03-03 [1] CRAN (R 4.0.2)                     
 prettyunits      1.1.1       2020-01-24 [1] CRAN (R 4.0.2)                     
 processx         3.5.2       2021-04-30 [1] CRAN (R 4.0.5)                     
 projpred         2.0.2       2020-10-28 [1] CRAN (R 4.0.2)                     
 promises         1.2.0.1     2021-02-11 [1] CRAN (R 4.0.2)                     
 ps               1.6.0       2021-02-28 [1] CRAN (R 4.0.2)                     
 purrr          * 0.3.4       2020-04-17 [1] CRAN (R 4.0.2)                     
 R6               2.5.0       2020-10-28 [1] CRAN (R 4.0.2)                     
 Rcpp           * 1.0.6       2021-01-15 [1] CRAN (R 4.0.2)                     
 RcppParallel     5.1.4       2021-05-04 [1] CRAN (R 4.0.2)                     
 readr          * 1.4.0       2020-10-05 [1] CRAN (R 4.0.2)                     
 readxl           1.3.1       2019-03-13 [1] CRAN (R 4.0.2)                     
 remotes          2.4.0       2021-06-02 [1] CRAN (R 4.0.2)                     
 reprex           2.0.0       2021-04-02 [1] CRAN (R 4.0.2)                     
 reshape2         1.4.4       2020-04-09 [1] CRAN (R 4.0.2)                     
 rlang            0.4.11.9000 2021-06-12 [1] Github (r-lib/rlang@b501cf7)       
 rprojroot        2.0.2       2020-11-15 [1] CRAN (R 4.0.2)                     
 rsconnect        0.8.18      2021-05-24 [1] CRAN (R 4.0.5)                     
 rstan            2.21.3      2021-06-12 [1] Github (stan-dev/rstan@da2fc9c)    
 rstantools       2.1.1       2020-07-06 [1] CRAN (R 4.0.2)                     
 rstudioapi       0.13        2020-11-12 [1] CRAN (R 4.0.2)                     
 rvest            1.0.0       2021-03-09 [1] CRAN (R 4.0.2)                     
 sandwich         3.0-1       2021-05-18 [1] CRAN (R 4.0.2)                     
 scales           1.1.1       2020-05-11 [1] CRAN (R 4.0.2)                     
 sessioninfo      1.1.1       2018-11-05 [1] CRAN (R 4.0.2)                     
 shiny            1.6.0       2021-01-25 [1] CRAN (R 4.0.2)                     
 shinyjs          2.0.0       2020-09-09 [1] CRAN (R 4.0.2)                     
 shinystan        2.5.0       2018-05-01 [1] CRAN (R 4.0.2)                     
 shinythemes      1.2.0       2021-01-25 [1] CRAN (R 4.0.2)                     
 StanHeaders      2.26.1      2021-04-17 [1] local                              
 stringi          1.6.2       2021-05-17 [1] CRAN (R 4.0.2)                     
 stringr        * 1.4.0       2019-02-10 [1] CRAN (R 4.0.2)                     
 survival         3.2-11      2021-04-26 [1] CRAN (R 4.0.2)                     
 svUnit           1.0.6       2021-04-19 [1] CRAN (R 4.0.2)                     
 testthat         3.0.2       2021-02-14 [1] CRAN (R 4.0.2)                     
 TH.data          1.0-10      2019-01-21 [1] CRAN (R 4.0.2)                     
 threejs          0.3.3       2020-01-21 [1] CRAN (R 4.0.2)                     
 tibble         * 3.1.2       2021-05-16 [1] CRAN (R 4.0.2)                     
 tidybayes      * 2.3.1       2020-11-02 [1] CRAN (R 4.0.2)                     
 tidyr          * 1.1.3       2021-03-03 [1] CRAN (R 4.0.2)                     
 tidyselect       1.1.1       2021-04-30 [1] CRAN (R 4.0.5)                     
 tidyverse      * 1.3.1       2021-04-15 [1] CRAN (R 4.0.2)                     
 usethis        * 2.0.1       2021-02-10 [1] CRAN (R 4.0.2)                     
 utf8             1.2.1       2021-03-12 [1] CRAN (R 4.0.2)                     
 V8               3.4.2       2021-05-01 [1] CRAN (R 4.0.2)                     
 vctrs            0.3.8.9000  2021-06-12 [1] Github (r-lib/vctrs@faccc3a)       
 withr            2.4.2       2021-04-18 [1] CRAN (R 4.0.2)                     
 xml2             1.3.2       2020-04-23 [1] CRAN (R 4.0.2)                     
 xtable           1.8-4       2019-04-21 [1] CRAN (R 4.0.2)                     
 xts              0.12.1      2020-09-09 [1] CRAN (R 4.0.2)                     
 zoo              1.8-9       2021-03-09 [1] CRAN (R 4.0.2)                     

[1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library

Reproducible example:

set.seed(123)
y <- rbinom(30, size = 1, prob = 0.2016)

# Fitting a simple binomial model using Stan
library(rstan)

model_string <- "
data {
  int n;
  int y[n];
}
parameters {
  real<lower=0, upper=1> theta;
}
model {
  y ~ bernoulli(theta);
}"

stan_samples <- stan(model_code = model_string, data = list(y = y, n = length(y)) )

If just run with one chain, this crashes in RStudio. In R, a prompt appears "selection:" and R crashes regardless of the choice (it's unclear what the choices are so I tried "1" and "2"; not entering anything repeats the prompt).

tfjaeger avatar Jun 12 '21 19:06 tfjaeger

Can confirm updating to R 4.1 from R 4.0.x and reinstalling RStan on MacOS Big Sur has fixed this problem for me.

Matthew-MacLeod-gc avatar Jul 29 '21 14:07 Matthew-MacLeod-gc

If install from CRAN, I don't get this problem. If I clone the latest develop from git and install from the local directory, I get warning and error

> 'config' variable 'CPP' is defunct
Warning message:
In system(paste(CPP, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  error in running command

RStan in CRAN says Published: 2021-12-19, but NEWS tells the latest change is Fri July 24 2020. git repo has develop as the default branch, but there is no tag indicating which version is 2.21.3. I'm confused!

> sessionInfo()
R version 4.1.2 (2021-11-01)
...
other attached packages:
[1] rstan_2.21.3         posterior_1.2.0      bayesplot_1.8.1     
[4] ggplot2_3.3.5        StanHeaders_2.21.0-7 dplyr_1.0.8         
[7] tidyr_1.2.0         

EDIT: added relevant sessionInfo

avehtari avatar Mar 10 '22 09:03 avehtari