I get errors saying (if I translate again)
“the update of mingw32 failed (locking of the data base is impossible)”
then the same error for mingw64.
and the 3rd error says “Synchronisation of all data bases failed”
Could this have something to do with the space in “Program Files”? My French mashine called it “Programmes” in the file explorer and replaces that name with “Program Files” when I copy the full path.
The installation of CmdStanR failed at the install_cmdstan() level when following the “Getting started” instructions (but library(cmdstanr) worked).
Here is the error message:
> install_cmdstan(cores = 2,overwrite=T)
* Latest CmdStan release is v2.24.0
* Installing CmdStan v2.24.0 in C:\Users\Antoine\Documents/.cmdstanr/cmdstan-2.24.0
* Downloading cmdstan-2.24.0.tar.gz from GitHub...
* Removing the existing installation of CmdStan...
* Download complete
* Unpacking archive...
* Building CmdStan binaries...
Error in rethrow_call(c_processx_exec, command, c(command, args), stdin, :
Command 'mingw32-make.exe' not found @win/processx.c:994 (processx_exec)
Type .Last.error.trace to see where the error occured
Thanks for any tips you can give me, I appreciate it because I’m totally inexperienced with this.
as admin and things have been downloaded and installed without error, it seems.
However, when checking “g++ --version” and “mingw32 --version” in a terminal (as admin and non-admin), it tells me the command is not recognised, so I don’t know if it worked or not. “bash --version” works.
After that, I opened RStudio and re-ran the CmdStanR installation to try it out and I still have the error:
>install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
Installing package into ‘C:/Users/Antoine/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
cmdstanr 0.0.0.9008 0.1.1 FALSE
installing the source package ‘cmdstanr’
essai de l'URL 'https://mc-stan.org/r-packages/src/contrib/cmdstanr_0.1.1.tar.gz'
Content type 'application/gzip' length 268716 bytes (262 KB)
downloaded 262 KB
* installing *source* package 'cmdstanr' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'cmdstanr'
finding HTML links ... fini
CmdStanGQ html
CmdStanMCMC html
CmdStanMLE html
CmdStanModel html
CmdStanVB html
cmdstan_default_install_path html
cmdstan_default_path html
cmdstan_model html
cmdstanr-package html
cmdstanr_example html
eng_cmdstan html
fit-method-cmdstan_summary html
fit-method-draws html
fit-method-init html
fit-method-inv_metric html
fit-method-lp html
fit-method-metadata html
fit-method-mle html
fit-method-output html
fit-method-sampler_diagnostics html
fit-method-save_object html
fit-method-save_output_files html
fit-method-summary html
fit-method-time html
install_cmdstan html
model-method-compile html
model-method-generate-quantities html
model-method-optimize html
model-method-sample html
model-method-variational html
read_cmdstan_csv html
read_sample_csv html
register_knitr_engine html
set_cmdstan_path html
stan_threads html
write_stan_json html
write_stan_tempfile html
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (cmdstanr)
The downloaded source packages are in
‘C:\Users\Antoine\AppData\Local\Temp\Rtmpq4bD6u\downloaded_packages’
> library(cmdstanr)
This is cmdstanr version 0.1.1
- Online documentation and vignettes at mc-stan.org/cmdstanr
- CmdStan path set to: C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0
- Use set_cmdstan_path() to change the path
> library(posterior)
This is posterior version 0.1.2
> library(bayesplot)
This is bayesplot version 1.7.2
- Online documentation and vignettes at mc-stan.org/bayesplot
- bayesplot theme set to bayesplot::theme_default()
* Does _not_ affect other ggplot2 plots
* See ?bayesplot_theme_set for details on theme setting
Attachement du package : ‘bayesplot’
The following object is masked from ‘package:posterior’:
rhat
> color_scheme_set("brightblue")
> install_cmdstan(cores = 2)
* Latest CmdStan release is v2.24.0
* Installing CmdStan v2.24.0 in C:\Users\Antoine\Documents/.cmdstanr/cmdstan-2.24.0
* Downloading cmdstan-2.24.0.tar.gz from GitHub...
Warning message:
An installation already exists at C:\Users\Antoine\Documents/.cmdstanr/cmdstan-2.24.0. Please remove or rename the installation folder or set overwrite=TRUE.
> install_cmdstan(cores = 2,overwrite=T)
* Latest CmdStan release is v2.24.0
* Installing CmdStan v2.24.0 in C:\Users\Antoine\Documents/.cmdstanr/cmdstan-2.24.0
* Downloading cmdstan-2.24.0.tar.gz from GitHub...
* Removing the existing installation of CmdStan...
* Download complete
* Unpacking archive...
* Building CmdStan binaries...
Error in rethrow_call(c_processx_exec, command, c(command, args), stdin, :
Command 'mingw32-make.exe' not found @win/processx.c:994 (processx_exec)
Type .Last.error.trace to see where the error occured
>
Yes, those paths are correct and they are what I put in PATH.
When installing rtools40, I did install it in “Program Files” because that where I have all my other stuff.
Maybe I should just reinstall it and keep all defaults?
Cheers
I fixed that and re-did the whole procedure and it seems to have worked up to the point when I run install_cmdstan(cores=2,overwrite=T), which now gives me a new error:
devtools::install_github("stan-dev/cmdstanr")
Downloading GitHub repo stan-dev/cmdstanr@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?
1: All
2: CRAN packages only
3: None
4: posterior (0.1.2 -> af3bfa094...) [GitHub]
Enter one or more numbers, or an empty line to skip updates:1
posterior (0.1.2 -> af3bfa094...) [GitHub]
bit (NA -> 4.0.4 ) [CRAN]
Installing 1 packages: bit
Installing package into ‘C:/Users/Antoine/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
essai de l'URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/bit_4.0.4.zip'
Content type 'application/zip' length 636521 bytes (621 KB)
downloaded 621 KB
package ‘bit’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Antoine\AppData\Local\Temp\RtmpeswAII\downloaded_packages
Downloading GitHub repo stan-dev/posterior@HEAD
√ checking for file 'C:\Users\Antoine\AppData\Local\Temp\RtmpeswAII\remotes128861e94ad2\stan-dev-posterior-af3bfa0/DESCRIPTION' (491ms)
- preparing 'posterior': (1.1s)
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts (623ms)
- checking for empty or unneeded directories
- building 'posterior_0.1.2.tar.gz'
Installing package into ‘C:/Users/Antoine/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'posterior' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'posterior'
finding HTML links ... fini
autocorrelation html
autocovariance html
bind_draws html
dot-ess html
dot-rhat html
draws-index html
draws html
draws_array html
draws_df html
draws_list html
draws_matrix html
draws_summary html
ess_basic html
ess_bulk html
ess_mean html
ess_quantile html
ess_sd html
ess_tail html
example_draws html
extract_variable html
extract_variable_matrix html
fold_draws html
mcse_mean html
mcse_quantile html
mcse_sd html
merge_chains html
mutate_variables html
order_draws html
posterior-package html
print.draws_array html
print.draws_df html
print.draws_list html
print.draws_matrix html
quantile2 html
r_scale html
rename_variables html
repair_draws html
resample_draws html
rhat html
rhat_basic html
split_chains html
subset_draws html
thin_draws html
u_scale html
weight_draws html
weights.draws html
z_scale html
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (posterior)
√ checking for file 'C:\Users\Antoine\AppData\Local\Temp\RtmpeswAII\remotes128874183c30\stan-dev-cmdstanr-39e5f96/DESCRIPTION' (358ms)
- preparing 'cmdstanr': (1.7s)
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts (570ms)
- checking for empty or unneeded directories
- building 'cmdstanr_0.1.1.tar.gz'
Installing package into ‘C:/Users/Antoine/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'cmdstanr' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'cmdstanr'
finding HTML links ... fini
CmdStanGQ html
CmdStanMCMC html
CmdStanMLE html
CmdStanModel html
CmdStanVB html
cmdstan_default_install_path html
cmdstan_default_path html
cmdstan_model html
cmdstanr-package html
cmdstanr_example html
eng_cmdstan html
fit-method-cmdstan_summary html
fit-method-draws html
fit-method-init html
fit-method-inv_metric html
fit-method-lp html
fit-method-metadata html
fit-method-mle html
fit-method-output html
fit-method-sampler_diagnostics html
fit-method-save_object html
fit-method-save_output_files html
fit-method-summary html
fit-method-time html
install_cmdstan html
model-method-compile html
model-method-generate-quantities html
model-method-optimize html
model-method-sample html
model-method-variational html
read_cmdstan_csv html
read_sample_csv html
register_knitr_engine html
set_cmdstan_path html
stan_threads html
write_stan_json html
write_stan_tempfile html
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (cmdstanr)
> library(cmdstanr)
This is cmdstanr version 0.1.1
- Online documentation and vignettes at mc-stan.org/cmdstanr
- CmdStan path set to: C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0
- Use set_cmdstan_path() to change the path
> library(posterior)
This is posterior version 0.1.2
> library(bayesplot)
This is bayesplot version 1.7.2
- Online documentation and vignettes at mc-stan.org/bayesplot
- bayesplot theme set to bayesplot::theme_default()
* Does _not_ affect other ggplot2 plots
* See ?bayesplot_theme_set for details on theme setting
Attachement du package : ‘bayesplot’
The following object is masked from ‘package:posterior’:
rhat
> color_scheme_set("brightblue")
> install_cmdstan(cores = 2,overwrite=T)
* Latest CmdStan release is v2.24.0
* Installing CmdStan v2.24.0 in C:\Users\Antoine\Documents/.cmdstanr/cmdstan-2.24.0
* Downloading cmdstan-2.24.0.tar.gz from GitHub...
* Removing the existing installation of CmdStan...
* Download complete
* Unpacking archive...
* Building CmdStan binaries...
Informationÿ: impossible de trouver des fichiers pour le(s) modŠle(s) sp‚cifi‚(s).
cp bin/windows-stanc bin/stanc.exe
g++ -std=c++1y -m64 -D_REENTRANT -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs -Wno-int-in-bool-context -Wno-attributes -Wno-ignored-attributes -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.7 -I stan/lib/stan_math/lib/boost_1.72.0 -I stan/lib/stan_math/lib/sundials_5.2.0/include -D_USE_MATH_DEFINES -DBOOST_DISABLE_ASSERTS -c -fvisibility=hidden -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp
cd stan/lib/stan_math/lib/boost_1.72.0; ./bootstrap.bat gcc
Building Boost.Build engine
g++ -std=c++1y -m64 -D_REENTRANT -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs -Wno-int-in-bool-context -Wno-attributes -Wno-ignored-attributes -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.7 -I stan/lib/stan_math/lib/boost_1.72.0 -I stan/lib/stan_math/lib/sundials_5.2.0/include -D_USE_MATH_DEFINES -DBOOST_DISABLE_ASSERTS -c -fvisibility=hidden -o bin/cmdstan/print.o src/cmdstan/print.cpp
C:/Program Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Program: No such file or directory
C:/Program Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
Fichier introuvable
Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.
mingw32-make.exe: *** [make/command:35: stan/lib/stan_math/lib/boost_1.72.0/stage/lib/libboost_program_options*.a] Error 1
mingw32-make.exe: *** Waiting for unfinished jobs....
Warning message:
There was a problem during installation. See the error message(s) above.
You can ignore that one. Still getting to the bottom as to why it occasionally occurs on some Windows installs. I think you may have another compiler in PATH and that does not play well.
Anyhow, just try.
library(cmdstanr)
file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
mod <- cmdstan_model(file)
data_list <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1))
fit <- mod$sample(
data = data_list,
seed = 123,
chains = 4,
parallel_chains = 2,
refresh = 500
)
The first compile will take some time, but then everything will work as it should.
I am encountering the same warning as the OP in this thread (namely “‘C:/rtools40/usr/mingw_/bin/g++’ not found”). Like the OP I don’t have a directory called C:/rtools40/usr/mingw_/bin (although I do have C:\rtools40\mingw64\bin). However, I notice that https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started says:
On Windows you may get a warning about g++ not being found but this appears to be harmless.
I assume this refers to the warning we are getting. Is that right?
In my case it does seem to be harmless, although I have not kept timings, and therefore I don’t know whether it has affected compilation times, or sampling times.
Update: The combined thread on these kinds of issues has the definitive reply (I think) to this warning: Rstan on Windows
> file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
> mod <- cmdstan_model(file)
Compiling Stan program...
Informationÿ: impossible de trouver des fichiers pour le(s) modŠle(s) sp‚cifi‚(s).
Informationÿ: impossible de trouver des fichiers pour le(s) modŠle(s) sp‚cifi‚(s).
ar: création de stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_nvecserial.a
ar: création de stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_cvodes.a
ar: création de stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_idas.a
ar: création de stan/lib/stan_math/lib/sundials_5.2.0/lib/libsundials_kinsol.a
C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb_2019_U8/build/Makefile.tbb:28: CONFIG: cfg=release arch=intel64 compiler=gcc target=windows runtime=mingw8.3.0
task.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
arena.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
scheduler.o: duplicate section `.rdata$_ZTIN3tbb4taskE[_ZTIN3tbb4taskE]' has different size
C:/Program Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Program: No such file or directory
C:/Program Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find Files/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe: *** [make/program:62: C:/Users/Antoine/AppData/Local/Temp/RtmpstbwaD/model-21a02d866116.exe] Error 1
Erreur : An error occured during compilation! See the message above for more information.
If it says “cannot find C:/Program: No such file in directory”, isn’t that an indication that the space in “Program Files” causes problems?
Concerning the “g++” warning message when running stan(), I confirm that it does not seem to prevent anything, I was able to run multiple (simple) models without issues.
In line 7, it says “Information: Unable to find files for the specified models”. It has weird characters in it, but that is what I think it says.
In this chunk, “Fichier introuvable” means “Unable to find file”:
NOTE: Please add C:/Users/Antoine/Documents/.cmdstanr/cmdstan-2.24.0/stan/lib/stan_math/lib/tbb to your PATH variable.
You may call mingw32-make install-tbb to automatically update your user configuration.
I assume
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")