# Errors when using cmdstan\_model()

**URL:** <https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984>\
**Category:** CmdStan\
**Tags:** fitting-issues\
**Created:** [May 9, 2020, 5:06am UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984 "2020-05-09T05:06:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 9, 2020, 5:06am UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/1 "2020-05-09T05:06:34Z")

</div>

I am a windows R user and I have successully install/library ‘cmdstanr’. Then I download cmdstan and set cmdstan\_path to the folder ‘cmdstan-2.23.0’. But when I ran cmdstan\_model(), there is an error message:

> pool\_model ← cmdstan\_model(stan\_file=‘pool\_sens\_spec.stan’)  
> Compiling Stan program…  
> ‘cut’ is not recognized as an internal or external command,  
> operable program or batch file.  
> ‘cut’ is not recognized as an internal or external command,  
> operable program or batch file.  
> INFO: Could not find files for the given pattern(s).  
> process\_begin: CreateProcess(NULL, cp bin/windows-stanc 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

**Expected behavior**  
I expected to reproduce the same result as one of the recent coronavirus studies using cmdstanr: [https://github.com/stan-dev/example-models/blob/master/jupyter/covid-inf-rate/SantaClara\_CmdStanR.ipynb](https://github.com/stan-dev/example-models/blob/master/jupyter/covid-inf-rate/SantaClara_CmdStanR.ipynb)

**Operating system**  
Windows 10

**CmdStanR version number**  
‘0.0.0.9000’

**Additional context**

1. The folder ‘cmdstan-2.23.0’ is inside the folder where I set as my R working directory.
2. when I try system (wget “www…”) it said I don’t have wget in my computer so instead I use wget() function in ‘HelpersMG’ package. Not sure whether this will have any effect on this error.

---

<div class="post-metadata">

**Author:** ![rok\_cesnovar](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rok\_cesnovar](https://discourse.mc-stan.org/u/rok_cesnovar)\
**Post date:** [May 9, 2020, 5:24am UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/2 "2020-05-09T05:24:46Z")

</div>

Hi,

a couple questions before I give more advice:

- what version of R and RTools do you have installed?
- if you run “g++ --version” in the comand line what does it return?

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 9, 2020, 1:59pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/3 "2020-05-09T13:59:47Z")

</div>

Hi,

1. g++ (Rev5, Built by MSYS2 project) 5.3.0  
Copyright © 2015 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.

2. I am using Rstudio 1.2.1335 based on R version 3.6.1 (2019-07-05).

Sorry I am not a command-line user so I am really confused about the error message. Also I am not sure whether my replacement of system(wget, “www…”) by wget() will alright or I need to first figure out why I cannot use system(wget, “www…”) due to the error message ‘‘wget’ not found’.

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 9, 2020, 3:18pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/4 "2020-05-09T15:18:56Z")

</div>

Another quick follow-up is that it seems that I didn’t get the RTools installed in my computer since I typed in the folllowing code:

> rtools\_path()  
> WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools custom from [RTools: Toolchains for building R and R packages from source on Windows](https://cran.r-project.org/bin/windows/Rtools/).  
Error in get(name, envir = cache) : object ‘rtools\_path’ not found

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 9, 2020, 10:54pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/5 "2020-05-09T22:54:52Z")

</div>

Hi,

I just finished installing Rtools based on the suggestion of Rstan using: pkgbuild::has\_build\_tools(debug = TRUE)

Then when I rerun the code, the error becomes:

> 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/RtmpkXXTy7/model-17247038ca2.exe] Error 1  
> Error in processx::run(command = make\_cmd(), args = c(tmp\_exe, include\_paths, :  
> System command error

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 9, 2020, 11:35pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/6 "2020-05-09T23:35:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 12, 2020, 11:43pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/7 "2020-05-12T23:43:23Z")

</div>

Hi,

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

Best,  
Siquan

---

<div class="post-metadata">

**Author:** ![jonah](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jonah/32/200_2.png) [@jonah](https://discourse.mc-stan.org/u/jonah)\
**Post date:** [May 13, 2020, 9:43pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/8 "2020-05-13T21:43:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mitzimorris](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mitzimorris/32/29_2.png) [@mitzimorris](https://discourse.mc-stan.org/u/mitzimorris)\
**Post date:** [May 14, 2020, 3:10am UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/9 "2020-05-14T03:10:59Z")

</div>

> [@Siquan-Wang](#):
>
> I expected to reproduce the same result as one of the recent coronavirus studies using cmdstanr: [https://github.com/stan-dev/example-models/blob/master/jupyter/covid-inf-rate/SantaClara\_CmdStanR.ipynb](https://github.com/stan-dev/example-models/blob/master/jupyter/covid-inf-rate/SantaClara_CmdStanR.ipynb)

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:

```no-highlight
# 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 [Getting started with CmdStanR • cmdstanr](https://mc-stan.org/cmdstanr/articles/cmdstanr.html#installing-cmdstan)

I will update the notebooks to make this clear.

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 14, 2020, 3:25am UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/10 "2020-05-14T03:25:00Z")

</div>

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](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](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?

---

<div class="post-metadata">

**Author:** ![mitzimorris](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mitzimorris/32/29_2.png) [@mitzimorris](https://discourse.mc-stan.org/u/mitzimorris)\
**Post date:** [May 14, 2020, 3:12pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/11 "2020-05-14T15:12:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 15, 2020, 3:01pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/12 "2020-05-15T15:01:23Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![mitzimorris](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mitzimorris/32/29_2.png) [@mitzimorris](https://discourse.mc-stan.org/u/mitzimorris)\
**Post date:** [May 15, 2020, 3:42pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/13 "2020-05-15T15:42:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 15, 2020, 3:49pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/14 "2020-05-15T15:49:26Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![rok\_cesnovar](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rok\_cesnovar](https://discourse.mc-stan.org/u/rok_cesnovar)\
**Post date:** [May 15, 2020, 4:01pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/15 "2020-05-15T16:01:37Z")

</div>

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

Please read through this issue.

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 15, 2020, 4:29pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/16 "2020-05-15T16:29:52Z")

</div>

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 [R Interface to CmdStan • cmdstanr](http://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 [R Interface to CmdStan • cmdstanr](http://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!

---

<div class="post-metadata">

**Author:** ![mitzimorris](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mitzimorris/32/29_2.png) [@mitzimorris](https://discourse.mc-stan.org/u/mitzimorris)\
**Post date:** [May 15, 2020, 4:53pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/17 "2020-05-15T16:53:47Z")

</div>

> [@Siquan-Wang](#):
>
> 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

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

update: answer no.

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 15, 2020, 5:19pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/18 "2020-05-15T17:19:14Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![rok\_cesnovar](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rok\_cesnovar](https://discourse.mc-stan.org/u/rok_cesnovar)\
**Post date:** [May 15, 2020, 5:51pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/19 "2020-05-15T17:51:40Z")

</div>

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/](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.

---

<div class="post-metadata">

**Author:** ![Siquan-Wang](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Siquan-Wang](https://discourse.mc-stan.org/u/Siquan-Wang)\
**Post date:** [May 15, 2020, 7:34pm UTC](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984/20 "2020-05-15T19:34:47Z")

</div>

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

 ![11](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/6/625d64be9051793de8cb055a4dc8ef446bcf56f9.png)

After

 ![22](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/a/ae30748a37fa9efa953772a78cd71bc493e0d336.png)

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 [R Interface to CmdStan • cmdstanr](http://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!

[Next page](https://discourse.mc-stan.org/t/errors-when-using-cmdstan-model/14984.md?page=2)
