Problem with cmdstanr in Win 10 . C++ installed conflict with Rtools

I have problem with cmdstan

library(cmdstanr)
library(posterior)
library(bayesplot)

check_cmdstan_toolchain(fix = TRUE)
Other C++ toolchains installed on your system conflict with RTools.

I do not konw why this happen, I used rstan just before. and i want to learn cmdstam. but i could not finish installment.

i am looking for help and thank you

Can you run

check_cmdstan_toolchain(fix = TRUE, quiet = FALSE)

and post the output?
Have you restarted the R session?

nstalling mingw32-make and writing RTools path to ~/.Renviron …
Error
Other C++ toolchains installed on your system conflict with RTools.
Please run check_cmdstan_toolchain(fix = TRUE) to fix the issue.

yes i have tried many times.

Ok, thanks.

Does this command:

rtools_usr_bin <- file.path(Sys.getenv("RTOOLS40_HOME"), "usr", "bin")
  processx::run(
    "pacman",
    args = c("-Syu", "mingw-w64-x86_64-make","--noconfirm"),
    wd = rtools_usr_bin,
    error_on_status = TRUE
  )

fail?

Also please post what does Sys.getenv("RTOOLS40_HOME") return.

Thank you very much

When i run your suggestion code. i get

$status
[1] 0

$stdout
[1] “:: Synchronizing package databases…\n mingw32 is up to date\n mingw64 is up to date\n:: Starting core system upgrade…\n there is nothing to do\n:: Starting full system upgrade…\nresolving dependencies…\nlooking for conflicting packages…\n\nPackages (1) mingw-w64-x86_64-make-4.2.1-2\n\nTotal Installed Size: 1.33 MiB\nNet Upgrade Size: 0.00 MiB\n\n:: Proceed with installation? [Y/n] \nchecking keyring…\nchecking package integrity…\nloading package files…\nchecking for file conflicts…\nchecking available disk space…\n:: Processing package changes…\nreinstalling mingw-w64-x86_64-make…\n”

$stderr
[1] “warning: mingw-w64-x86_64-make-4.2.1-2 is up to date – reinstalling\n”

$timeout
[1] FALSE

it is no error shown

and i run

 Sys.getenv("RTOOLS40_HOME") 

i found my path

[1] “C:\RBuildTools\4.0”

Ok, thanks.

Does


write('PATH="${RTOOLS40_HOME}\\usr\\bin;${RTOOLS40_HOME}\\mingw64\\bin;${PATH}"', file = "~/.Renviron", append = TRUE)

work then?
I am guessing that this fails given that check_cmdstan_toolchain fails.

Thank you agian Rok

but unfortunately, it dose not work.

i have followed your advice :

write('PATH="${RTOOLS40_HOME}\\usr\\bin;${RTOOLS40_HOME}\\mingw64\\bin;${PATH}"', file = "~/.Renviron", append = TRUE)

but it is sitll error here.

Installing mingw32-make and writing RTools path to ~/.Renviron …
Error:
Other C++ toolchains installed on your system conflict with RTools.
Please run check_cmdstan_toolchain(fix = TRUE) to fix the issue.

My session is
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

i have tried the beta version cdmstanr and latest version.

they are not work.

Sorry for the troubles.
Can you try:

install_cmdstan(check_toolchain = TRUE)

you are so nicely.

i have tried your suggestion. but it is not work too,

the err information is same,

‘’’{r}
Other C++ toolchains installed on your system conflict with RTools.
Please run check_cmdstan_toolchain(fix = TRUE) to fix the issue.
‘’’

i use bush to find my c++ version.

when i put the " c++ --version" it shows that

c++ (Built by Jeroen for the R-project) 8.3.0
Copyright © 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

i am not sure shoud i use more up to date version?

or because of my locale is?:

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936  LC_CTYPE=Chinese (Simplified)_China.936    LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C                               LC_TIME=Chinese (Simplified)_China.936    

thank you very much.

Sorry, I meant.

install_cmdstan(check_toolchain = FALSE)

1 Like

it worked.

Thanks for your help.

i am so happy to get your help.

1 Like

@fanzheng0352 Great, glad it’s working now!

@rok_cesnovar Thanks for figuring this out. Since in this case the default of check_toolchain=TRUE was actually preventing this from working, do you think it makes sense to automatically try with FALSE if there’s an error when TRUE? Or is there something else we can do to avoid this?

@fanzheng0352 great! Sorry for the trouble.

@jonah I think I need to figure out why it failed here. The other option would be to go with FALSE and suggest running check_cmdstan_toolchain if install_cmdstan fails.

1 Like