# Rstan installation problem

**URL:** <https://discourse.mc-stan.org/t/rstan-installation-problem/18813>\
**Category:** RStan\
**Tags:** installation, windows, rstan\
**Created:** [October 21, 2020, 7:27pm UTC](https://discourse.mc-stan.org/t/rstan-installation-problem/18813 "2020-10-21T19:27:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gao\_jie](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/gao_jie/32/9700_2.png) [@gao\_jie](https://discourse.mc-stan.org/u/gao_jie)\
**Post date:** [October 21, 2020, 7:27pm UTC](https://discourse.mc-stan.org/t/rstan-installation-problem/18813/1 "2020-10-21T19:27:05Z")

</div>

Hi,  
I had Rstan running, it took one hour for my computer while it took 1 minute on other people’s computer. So I decided to reinstall R, Rstudio, Rstan, and Rtools. However, after I re-installed everything,

1. it runs fine for extremely simple code,
2. regular IRT takes 10 minutes too run (too long),
3. my regular model will not run. It gives the error “Error: cannot allocate vector of size 16687.6 Gb  
In addition: Warning message:  
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :  
‘C:/rtools40/usr/mingw\_/bin/g++’ not found”

I suspect the installation is not perfect, and tried all the suggestions I got from the internet and other people, but still doesn’t work. I’d really appreciate it if you could help.  
Thank you!

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [October 21, 2020, 10:20pm UTC](https://discourse.mc-stan.org/t/rstan-installation-problem/18813/2 "2020-10-21T22:20:34Z")

</div>

What is `Sys.getenv("PATH")`?

---

<div class="post-metadata">

**Author:** ![gao\_jie](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/gao_jie/32/9700_2.png) [@gao\_jie](https://discourse.mc-stan.org/u/gao_jie)\
**Post date:** [November 3, 2020, 5:10pm UTC](https://discourse.mc-stan.org/t/rstan-installation-problem/18813/3 "2020-11-03T17:10:21Z")

</div>

> [@bgoodri](#):
>
> Sys.getenv(“PATH”)

Thank you for helping.

It returens:

“C:\rtools40\usr\bin;C:\oracle\product\11.2.0\client\_1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\oracle\product\11.2.0\client\_1\bin;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\1E\Client\Extensibility\NomadBranch;C:\Program Files\1E\NomadBranch\;C:\rtools40\mingw64\bin;C:\rtools40\mingw\_64\bin\g++;C:\rtools40\mingw\_64\bin\g++.exe;C:\Users\jgao\AppData\Local\Microsoft\WindowsApps;C:\Program Files\mingw-w64\x86\_64-8.1.0-posix-seh-rt\_v6-rev0\mingw64\bin;C:\2020 MIRT - shelby\64 bit;”

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [November 3, 2020, 6:11pm UTC](https://discourse.mc-stan.org/t/rstan-installation-problem/18813/4 "2020-11-03T18:11:27Z")

</div>

I don’t think C:\rtools40\usr\bin is a valid directory. In R, what is

```
Sys.getenv("RTOOLS40_HOME")

```

? Also, while C:\rtools40\mingw64\bin is valid, it might need to be higher up on the PATH, and both copies of C:\rtools40\mingw\_64\bin\g++ on the PATH should be deleted because they are executables rather than directories. In short, whoever or whatever set your PATH environmental variable did it wrong.

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [November 3, 2020, 11:27pm UTC](https://discourse.mc-stan.org/t/rstan-installation-problem/18813/5 "2020-11-03T23:27:21Z")

</div>

Can you go through the R4.0 installation instructions here: [https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-source-on-Windows#r40](https://github.com/stan-dev/rstan/wiki/Installing-RStan-from-source-on-Windows#r40)

That will help debug your setup
