Errors when using cmdstan_model()

Actually when I ran the same code twice, it seems that the error messages are different(Error 1 vs Error 2):

pool_model <- cmdstan_model(stan_file=‘pool_sens_spec.stan’)
Compiling Stan program…
INFO: Could not find files for the given pattern(s).
process_begin: CreateProcess(NULL, chmod +x bin/stanc.exe, …) failed.
make (e=2): The system cannot find the file specified.
mingw32-make.exe: *** [bin/stanc.exe] Error 2
Error in processx::run(command = make_cmd(), args = c(tmp_exe, include_paths, :
System command error

pool_model <- cmdstan_model(stan_file=‘pool_sens_spec.stan’)
Compiling Stan program…
INFO: Could not find files for the given pattern(s).
INFO: Could not find files for the given pattern(s).
g++.exe: error: stan/lib/stan_math/lib/tbb/tbb.dll: No such file or directory
mingw32-make.exe: *** [C:/Users/SIQUAN~1/AppData/Local/Temp/RtmpG00xBe/model-3500df55aca.exe] Error 1
Error in processx::run(command = make_cmd(), args = c(tmp_exe, include_paths, :
System command error

Hi,

May I ask that is there any follow-up suggestions on how to fix this problem?

Best,
Siquan

Sorry you’re still getting an error. Unfortunately I know nothing about Windows. @rok_cesnovar or other Windows people, any ideas what’s going wrong here?

if I understand you, you’re running on a windows machine, but you tried to install the CmdStan binaries in the example notebook, i.e., you tried to run this cell:

# Install CmdStan binaries
if (!file.exists("cmdstan-2.23.0.tar.gz")) {
  system("wget https://github.com/stan-dev/cmdstan/releases/download/v2.23.0/colab-cmdstan-2.23.0.tar.gz", intern=T)
  system("tar zxf colab-cmdstan-2.23.0.tar.gz", intern=T)
}
list.files("cmdstan-2.23.0")

that is the problem - these binaries will only work on a linux (debian) install.
on a Windows machine, you’ll need to run the install_cmdstan() function - see https://mc-stan.org/cmdstanr/articles/cmdstanr.html#installing-cmdstan

I will update the notebooks to make this clear.

Hi,

Yes indeed I have encountered some problems in running:

if (!file.exists(“cmdstan-2.23.0.tar.gz”)) {
system(“wget https://github.com/stan-dev/cmdstan/releases/download/v2.23.0/colab-cmdstan-2.23.0.tar.gz”, intern=T)
system(“tar zxf colab-cmdstan-2.23.0.tar.gz”, intern=T)
}

Since my computer does not recognize the Windows command ‘wget’, however I changed it as following and I believe I have successfully downloaded cmdstan:

library(HelpersMG)
if (!file.exists(“cmdstan-2.23.0.tar.gz”)) {
wget(“https://github.com/stan-dev/cmdstan/releases/download/v2.23.0/colab-cmdstan-2.23.0.tar.gz”)
system(“tar zxf colab-cmdstan-2.23.0.tar.gz”, intern=T)
}

because I have:

cmdstan_version()
[1] “2.23.0”

But when I tried to run the example code the error is still as following (there are Error 1 and Error 2):

pool_model <- cmdstan_model(stan_file=‘pool_sens_spec.stan’)
Compiling Stan program…
INFO: Could not find files for the given pattern(s).
process_begin: CreateProcess(NULL, chmod +x bin/stanc.exe, …) failed.
make (e=2): The system cannot find the file specified.
mingw32-make.exe: *** [bin/stanc.exe] Error 2
Error in processx::run(command = make_cmd(), args = c(tmp_exe, include_paths, :
System command error

pool_model <- cmdstan_model(stan_file=‘pool_sens_spec.stan’)
Compiling Stan program…
INFO: Could not find files for the given pattern(s).
INFO: Could not find files for the given pattern(s).
g++.exe: error: stan/lib/stan_math/lib/tbb/tbb.dll: No such file or directory
mingw32-make.exe: *** [C:/Users/SIQUAN~1/AppData/Local/Temp/RtmpG00xBe/model-3500df55aca.exe] Error 1
Error in processx::run(command = make_cmd(), args = c(tmp_exe, include_paths, :
System command error

Is the question still related to incorrectly installed cmdstan?

yes, is it the same problem.

the code in the Colab notebook is only for running on Colab
when you are running on Windows, you need to install cmdstan via the install_cmdstan() command.
it’s possible that CmdStanR is confused because the binaries for linux are present, and so it won’t do a clean re-install. please try this:

  • first remove the folder that you downloaded/installed via wget.
  • then run CmdStanR’s “install_cmdstan()” function
1 Like

Thanks so much for your kindly reply!

However when I removed the folder I downloaded via wget and then ran install_cmdstan(), the following error messgae showed up:

install_cmdstan()

  • Latest CmdStan release is v2.23.0
  • Installing CmdStan v2.23.0 in C:/Users/Siquan Wang/Documents/.cmdstanr
  • Downloading cmdstan-2.23.0.tar.gz from GitHub…
  • Download complete
  • Unpacking archive…
  • Building CmdStan binaries…
    INFO: Could not find files for the given pattern(s).
    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 -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.3 -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 -MT src/cmdstan/stanc.o -M -E -MG -MP -MF src/cmdstan/stanc.d src/cmdstan/stanc.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/ast_def.o -MT stan/src/stan/lang/ast_def.d -M -E -MG -MP -MF stan/src/stan/lang/ast_def.d stan/src/stan/lang/ast_def.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/semantic_actions_def.o -MT stan/src/stan/lang/grammars/semantic_actions_def.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/semantic_actions_def.d stan/src/stan/lang/grammars/semantic_actions_def.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/program_grammar_inst.o -MT stan/src/stan/lang/grammars/program_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/program_grammar_inst.d stan/src/stan/lang/grammars/program_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/expression_grammar_inst.o -MT stan/src/stan/lang/grammars/expression_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/expression_grammar_inst.d stan/src/stan/lang/grammars/expression_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/statement_grammar_inst.o -MT stan/src/stan/lang/grammars/statement_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/statement_grammar_inst.d stan/src/stan/lang/grammars/statement_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/expression07_grammar_inst.o -MT stan/src/stan/lang/grammars/expression07_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/expression07_grammar_inst.d stan/src/stan/lang/grammars/expression07_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/statement_2_grammar_inst.o -MT stan/src/stan/lang/grammars/statement_2_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/statement_2_grammar_inst.d stan/src/stan/lang/grammars/statement_2_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/block_var_decls_grammar_inst.o -MT stan/src/stan/lang/grammars/block_var_decls_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/block_var_decls_grammar_inst.d stan/src/stan/lang/grammars/block_var_decls_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/indexes_grammar_inst.o -MT stan/src/stan/lang/grammars/indexes_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/indexes_grammar_inst.d stan/src/stan/lang/grammars/indexes_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/local_var_decls_grammar_inst.o -MT stan/src/stan/lang/grammars/local_var_decls_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/local_var_decls_grammar_inst.d stan/src/stan/lang/grammars/local_var_decls_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/whitespace_grammar_inst.o -MT stan/src/stan/lang/grammars/whitespace_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/whitespace_grammar_inst.d stan/src/stan/lang/grammars/whitespace_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/bare_type_grammar_inst.o -MT stan/src/stan/lang/grammars/bare_type_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/bare_type_grammar_inst.d stan/src/stan/lang/grammars/bare_type_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/term_grammar_inst.o -MT stan/src/stan/lang/grammars/term_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/term_grammar_inst.d stan/src/stan/lang/grammars/term_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/functions_grammar_inst.o -MT stan/src/stan/lang/grammars/functions_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/functions_grammar_inst.d stan/src/stan/lang/grammars/functions_grammar_inst.cpp
    INFO: Could not find files for the given pattern(s).
    cp bin/windows-stanc bin/stanc.exe
    chmod +x bin/stanc.exe
    make/stanc:61: recipe for target ‘bin/stanc.exe’ failed
    process_begin: CreateProcess(NULL, chmod +x bin/stanc.exe, …) failed.
    make (e=2): The system cannot find the file specified.
    mingw32-make.exe: *** [bin/stanc.exe] Error 2
    mingw32-make.exe: *** Waiting for unfinished jobs…
    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 -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.3 -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 -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp

Warning message:
There was a problem during installation. See the error message(s) above.

I am not sure why this error would happen and could you give me some advice on how to fix it?

Thx!

1 Like

pinging @rok_cesnovar to look at the output from failed instal_cmdstan() call.
not sure what’s going on.

@Siquan-Wang - what version of Windows do you have? and R?

Hi,

I am using Windows 10 pro (64bit) on Lenovo P71 and my R version is “R version 3.6.1 (2019-07-05)”.

Thx!

This is the same issue as here: https://github.com/stan-dev/cmdstan/issues/873

Please read through this issue.

2 Likes

Hi,

I repeated the same procedure but it seems that the error is still there (sorry to copy and paste the long output again):

library(cmdstanr)
This is cmdstanr version 0.0.0.9000

  • Online documentation and vignettes at mc-stan.org/cmdstanr
  • CmdStan path set to: C:/Users/Siquan Wang/Documents/.cmdstanr/cmdstan
  • Use set_cmdstan_path() to change the path

install_cmdstan(overwrite=TRUE)

  • Removing the existing installation of CmdStan…
  • Latest CmdStan release is v2.23.0
  • Installing CmdStan v2.23.0 in C:/Users/Siquan Wang/Documents/.cmdstanr
  • Downloading cmdstan-2.23.0.tar.gz from GitHub…
  • Download complete
  • Unpacking archive…
  • Building CmdStan binaries…
    INFO: Could not find files for the given pattern(s).
    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 -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.3 -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 -MT src/cmdstan/stanc.o -M -E -MG -MP -MF src/cmdstan/stanc.d src/cmdstan/stanc.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/ast_def.o -MT stan/src/stan/lang/ast_def.d -M -E -MG -MP -MF stan/src/stan/lang/ast_def.d stan/src/stan/lang/ast_def.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/semantic_actions_def.o -MT stan/src/stan/lang/grammars/semantic_actions_def.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/semantic_actions_def.d stan/src/stan/lang/grammars/semantic_actions_def.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/program_grammar_inst.o -MT stan/src/stan/lang/grammars/program_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/program_grammar_inst.d stan/src/stan/lang/grammars/program_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/expression_grammar_inst.o -MT stan/src/stan/lang/grammars/expression_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/expression_grammar_inst.d stan/src/stan/lang/grammars/expression_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/statement_grammar_inst.o -MT stan/src/stan/lang/grammars/statement_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/statement_grammar_inst.d stan/src/stan/lang/grammars/statement_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/expression07_grammar_inst.o -MT stan/src/stan/lang/grammars/expression07_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/expression07_grammar_inst.d stan/src/stan/lang/grammars/expression07_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/statement_2_grammar_inst.o -MT stan/src/stan/lang/grammars/statement_2_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/statement_2_grammar_inst.d stan/src/stan/lang/grammars/statement_2_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/block_var_decls_grammar_inst.o -MT stan/src/stan/lang/grammars/block_var_decls_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/block_var_decls_grammar_inst.d stan/src/stan/lang/grammars/block_var_decls_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/indexes_grammar_inst.o -MT stan/src/stan/lang/grammars/indexes_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/indexes_grammar_inst.d stan/src/stan/lang/grammars/indexes_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/local_var_decls_grammar_inst.o -MT stan/src/stan/lang/grammars/local_var_decls_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/local_var_decls_grammar_inst.d stan/src/stan/lang/grammars/local_var_decls_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/whitespace_grammar_inst.o -MT stan/src/stan/lang/grammars/whitespace_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/whitespace_grammar_inst.d stan/src/stan/lang/grammars/whitespace_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/bare_type_grammar_inst.o -MT stan/src/stan/lang/grammars/bare_type_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/bare_type_grammar_inst.d stan/src/stan/lang/grammars/bare_type_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/term_grammar_inst.o -MT stan/src/stan/lang/grammars/term_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/term_grammar_inst.d stan/src/stan/lang/grammars/term_grammar_inst.cpp
    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 -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.3 -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 -MT bin/cmdstan/lang/grammars/functions_grammar_inst.o -MT stan/src/stan/lang/grammars/functions_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/functions_grammar_inst.d stan/src/stan/lang/grammars/functions_grammar_inst.cpp
    INFO: Could not find files for the given pattern(s).
    cp bin/windows-stanc bin/stanc.exe
    chmod +x bin/stanc.exe
    make/stanc:61: recipe for target ‘bin/stanc.exe’ failed
    process_begin: CreateProcess(NULL, chmod +x bin/stanc.exe, …) failed.
    make (e=2): The system cannot find the file specified.
    mingw32-make.exe: *** [bin/stanc.exe] Error 2
    mingw32-make.exe: *** Waiting for unfinished jobs…
    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 -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.3 -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 -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp

Warning message:
There was a problem during installation. See the error message(s) above.

file.copy(file.path(cmdstanr::cmdstan_default_path(),“bin”,“windows-stanc”), file.path(cmdstanr::cmdstan_default_path(),“bin”,“stanc.exe”))
[1] FALSE
processx::run(“mingw32-make”, c(“build”,"-j4"), wd=cmdstanr::cmdstan_default_path(), echo = TRUE)
INFO: Could not find files for the given pattern(s).
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 -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.3 -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 -Wl,-L,“C:/Users/Siquan Wang/Documents/.cmdstanr/cmdstan/stan/lib/stan_math/lib/tbb” -Wl,-rpath,“C:/Users/Siquan Wang/Documents/.cmdstanr/cmdstan/stan/lib/stan_math/lib/tbb” bin/cmdstan/stansummary.o -static-libgcc -static-libstdc++ -o bin/stansummary.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 -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.3 -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 -o bin/cmdstan/print.o src/cmdstan/print.cpp
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 -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.3 -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 -o bin/cmdstan/diagnose.o src/cmdstan/diagnose.cpp
g++ -pipe -m64 -D_REENTRANT -O3 -I stan/lib/stan_math/lib/sundials_5.2.0/include -DNO_FPRINTF_OUTPUT -D_USE_MATH_DEFINES -c -x c -include stan/lib/stan_math/lib/sundials_5.2.0/include/stan_sundials_printf_override.hpp stan/lib/stan_math/lib/sundials_5.2.0/src/nvector/serial/nvector_serial.c -o stan/lib/stan_math/lib/sundials_5.2.0/src/nvector/serial/nvector_serial.o
C:/Users/Siquan Wang/Anaconda3/Library/mingw-w64/bin/…/lib/gcc/x86_64-w64-mingw32/5.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Users/Siquan: No such file or directory
C:/Users/Siquan Wang/Anaconda3/Library/mingw-w64/bin/…/lib/gcc/x86_64-w64-mingw32/5.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: cannot find Wang/Anaconda3/Library/mingw-w64/bin/…/lib/gcc/x86_64-w64-mingw32/5.3.0/…/…/…/…/x86_64-w64-mingw32/lib/…/lib/default-manifest.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
make/command:11: recipe for target ‘bin/stansummary.exe’ failed
mingw32-make: *** [bin/stansummary.exe] Error 1
mingw32-make: *** Waiting for unfinished jobs…
Error in processx::run(“mingw32-make”, c(“build”, “-j4”), wd = cmdstanr::cmdstan_default_path(), :
System command error

Then I restarted R and ran the sample code it seems still not working properly:

library(cmdstanr)
This is cmdstanr version 0.0.0.9000

  • Online documentation and vignettes at mc-stan.org/cmdstanr
  • CmdStan path set to: C:/Users/Siquan Wang/Documents/.cmdstanr/cmdstan
  • Use set_cmdstan_path() to change the path

file <- file.path(cmdstan_path(), “examples”, “bernoulli”, “bernoulli.stan”)
mod <- cmdstan_model(file)
Compiling Stan program…
C:/Users/Siquan Wang/Anaconda3/Library/mingw-w64/bin/…/lib/gcc/x86_64-w64-mingw32/5.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Users/Siquan: No such file or directory
C:/Users/Siquan Wang/Anaconda3/Library/mingw-w64/bin/…/lib/gcc/x86_64-w64-mingw32/5.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: cannot find Wang/Anaconda3/Library/mingw-w64/bin/…/lib/gcc/x86_64-w64-mingw32/5.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: *** [C:/Users/SIQUAN~1/AppData/Local/Temp/Rtmp0qJ61a/model-466036a38cc.exe] Error 1
Error in processx::run(command = make_cmd(), args = c(tmp_exe, include_paths, :
System command error
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,
  • num_chains = 2,
  • num_cores = 2
  • )
    Error: object ‘mod’ not found

Thx!

is this a space in the path name problem? (C:/Users/Siquan Wang/)?

update: answer no.

Hi,

I am not sure but the space in the path name seems to be okay for all the other programs since I used this laptop 3 years ago. I am trying to change the folder name but it is far more complicated than I expected, still trying…

I think the problem is the use of Anaconda for mingw32. We advise the use of RTools.

If possible please remove C:/Users/Siquan Wang/Anaconda3/Library/mingw-w64/bin/ from your environment variables (tutorial on how to do that: https://www.architectryan.com/2018/08/31/how-to-change-environment-variables-on-windows-10/).

Then please install RTools 3.5 and make sure to tick the box to update the PATH environment variable.

Hi,

I just deleted the C:/Users/Siquan Wang/Anaconda3/Library/mingw-w64/bin/ from my environment variables and I found the RTools 3.5 has already been added to the path when I installed rstan as following:

Before

After

However, after restarting the computer this time the error message becomes:

library(cmdstanr)
This is cmdstanr version 0.0.0.9000

  • Online documentation and vignettes at mc-stan.org/cmdstanr
  • CmdStan path set to: C:/Users/Siquan Wang/Documents/.cmdstanr/cmdstan
  • Use set_cmdstan_path() to change the path

install_cmdstan(overwrite=TRUE)

  • Removing the existing installation of CmdStan…
  • Latest CmdStan release is v2.23.0
  • Installing CmdStan v2.23.0 in C:/Users/Siquan Wang/Documents/.cmdstanr
  • Downloading cmdstan-2.23.0.tar.gz from GitHub…
  • Download complete
  • Unpacking archive…
  • Building CmdStan binaries…
    Error in rethrow_call(c_processx_exec, command, c(command, args), stdin, :
    Command not found @win/processx.c:977

file.copy(file.path(cmdstanr::cmdstan_default_path(),“bin”,“windows-stanc”), file.path(cmdstanr::cmdstan_default_path(),“bin”,“stanc.exe”))
[1] TRUE
processx::run(“mingw32-make”, c(“build”,"-j4"), wd=cmdstanr::cmdstan_default_path(), echo = TRUE)
Error in rethrow_call(c_processx_exec, command, c(command, args), stdin, :
Command not found @win/processx.c:977
file <- file.path(cmdstan_path(), “examples”, “bernoulli”, “bernoulli.stan”)
mod <- cmdstan_model(file)
Compiling Stan program…
Error in rethrow_call(c_processx_exec, command, c(command, args), stdin, :
Command not found @win/processx.c:977

Sorry for the confusion and I really appreciate for your help!

Try adding C:\RBuildTools\3.5\mingw_64\bin to PATH and restart RStudio.

Thx!

Now it works!

3 Likes

@Siquan-Wang glad it’s working, thanks for your patience and not giving up!

Thanks @rok_cesnovar and @mitzimorris for helping sort this out.

2 Likes

hi @rok_cesnovar - is there a way to eliminate use of cut utility from makefiles? - users keep hitting this problem.
offending lines are here:

stan/lib/stan_math/make/compiler_flags:61:CXX_MAJOR := $(shell $(CXX) -dumpversion 2>&1 | cut -d'.' -f1)
stan/lib/stan_math/make/compiler_flags:62:CXX_MINOR := $(shell $(CXX) -dumpversion 2>&1 | cut -d'.' -f2)

Done: https://github.com/stan-dev/math/pull/2126

Thanks for pointing it out.

2 Likes