# Cannot install Rstan

**URL:** <https://discourse.mc-stan.org/t/cannot-install-rstan/24374>\
**Category:** General\
**Tags:** installation\
**Created:** [September 13, 2021, 12:34pm UTC](https://discourse.mc-stan.org/t/cannot-install-rstan/24374 "2021-09-13T12:34:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmabaei](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mmabaei/32/14573_2.png) [@mmabaei](https://discourse.mc-stan.org/u/mmabaei)\
**Post date:** [September 13, 2021, 12:34pm UTC](https://discourse.mc-stan.org/t/cannot-install-rstan/24374/1 "2021-09-13T12:34:41Z")

</div>

Hellos to al fellows,

I am trying to install rstan from the Github Stan help source:

> **[RStan Getting Started · stan-dev/rstan Wiki](https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started)**
>
> RStan, the R interface to Stan. Contribute to stan-dev/rstan development by creating an account on GitHub.

Last week I sucessfully installed it. but today I receive always thsi error:

Error: cannot allocate vector of size 12050.6 Gb  
In addition: Warning message:  
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :  
‘-E’ not found

I removed rstan and install it agin but does not work. Also I upgrated my R and Rstudio and Rtools however still i am receiving the smae error. I ahve no idea what should i do more.

Please help me to install the rstan.

---

<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:** [September 13, 2021, 1:45pm UTC](https://discourse.mc-stan.org/t/cannot-install-rstan/24374/2 "2021-09-13T13:45:24Z")

</div>

this is an evergreen question - discourse search on “cannot allocate vector” turns up this: [Error: cannot allocate vector of size 17348.7 Gb - #7 by RR\_Stan](https://discourse.mc-stan.org/t/error-cannot-allocate-vector-of-size-17348-7-gb/14615/7)

good luck.

---

<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:** [September 14, 2021, 3:01pm UTC](https://discourse.mc-stan.org/t/cannot-install-rstan/24374/3 "2021-09-14T15:01:53Z")

</div>

This error normally occurs when you have run models under R3.6, and then upgraded to R4.0 and are trying to run them again. To fix this, you need to remove any pre-compiled models by deleting the `.rds` files in the directory and starting in a clean R session

---

<div class="post-metadata">

**Author:** ![mmabaei](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mmabaei/32/14573_2.png) [@mmabaei](https://discourse.mc-stan.org/u/mmabaei)\
**Post date:** [September 15, 2021, 7:45am UTC](https://discourse.mc-stan.org/t/cannot-install-rstan/24374/4 "2021-09-15T07:45:35Z")

</div>

Dear Andrew,

Many thanks for your helpful advice. I did the advice and was work to my issue. regarding the .rds files, i am not sure if I should all the .rds file from R directory or just from the directory that my codes are there?
