# Rtools not properly detected in R3.6.0 under Windows 10

**URL:** https://discourse.mc-stan.org/t/rtools-not-properly-detected-in-r3-6-0-under-windows-10/9075
**Category:** General
**Created:** [June 3, 2019, 1:49pm UTC](https://discourse.mc-stan.org/t/rtools-not-properly-detected-in-r3-6-0-under-windows-10/9075 "2019-06-03T13:49:54Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Seb](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@Seb](https://discourse.mc-stan.org/u/Seb)
#### Post date: [June 3, 2019, 1:49pm UTC](https://discourse.mc-stan.org/t/rtools-not-properly-detected-in-r3-6-0-under-windows-10/9075/1 "2019-06-03T13:49:54Z")

</div>

Dear stan users,

I had problems installing rstan (2.18.2) under R 3.6.0 on a Windows 10 machine by following the [default instructions](https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started).

The problem was with Rtools3.5. Although the line:

```
pkgbuild::has_build_tools(debug = TRUE)

```

returned `TRUE` as it should, the tool chain was not working.

After some foul language, some googling and a few hours lost I found and fixed the problem. In order to save other people from losing time I thought I just post my solution in one place.

1. Unlike indicated in the installing instructions, Rtools needs to be included in the system path like so:  
 ![sys_path](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/9/94c93051e79be36e8d589b9680c499d5158eff3e.png)

2. The Makevars.win file need to include the line

```
CXX14=$(BINPREF)g++ -O2 -march=native -mtune=native

```

That’s all, hope it helps.

Seb

---

<div class="post-metadata">

### Author: ![increasechief](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/increasechief/32/2039_2.png) [@increasechief](https://discourse.mc-stan.org/u/increasechief)
#### Post date: [June 3, 2019, 1:52pm UTC](https://discourse.mc-stan.org/t/rtools-not-properly-detected-in-r3-6-0-under-windows-10/9075/2 "2019-06-03T13:52:53Z")

</div>

This fix almost deserves a PSA.

---

<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: [June 3, 2019, 10:45pm UTC](https://discourse.mc-stan.org/t/rtools-not-properly-detected-in-r3-6-0-under-windows-10/9075/3 "2019-06-03T22:45:05Z")

</div>

Sorry for the headache and thanks for sharing the fix that worked for you.

I don’t have Windows so can’t check for myself, maybe @bgoodri or @paul.buerkner can confirm? We definitely need to change the instructions if this is not some weird special case.

---

<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: [June 3, 2019, 10:56pm UTC](https://discourse.mc-stan.org/t/rtools-not-properly-detected-in-r3-6-0-under-windows-10/9075/4 "2019-06-03T22:56:27Z")

</div>

We just need to get a new rstan onto CRAN.

---

<div class="post-metadata">

### Author: ![paul.buerkner](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/paul.buerkner/32/3303_2.png) [@paul.buerkner](https://discourse.mc-stan.org/u/paul.buerkner)
#### Post date: [June 4, 2019, 7:14am UTC](https://discourse.mc-stan.org/t/rtools-not-properly-detected-in-r3-6-0-under-windows-10/9075/5 "2019-06-04T07:14:50Z")

</div>

Thanks! One question: In (1), you write about “sys\_path”, but this does not seem to be the full line you added to the system path, right?

---

<div class="post-metadata">

### Author: ![Seb](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@Seb](https://discourse.mc-stan.org/u/Seb)
#### Post date: [June 4, 2019, 7:34am UTC](https://discourse.mc-stan.org/t/rtools-not-properly-detected-in-r3-6-0-under-windows-10/9075/6 "2019-06-04T07:34:23Z")

</div>

Thanks for all the responses. As for the system path vars, I manually added:  
`C:\Rtools\bin;C:\Rtools\mingw_64\bin`

Actually these might be added automatically by ticking a box in one of the installer windows: ![path](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/4/49a7e17307575632ef758cf52c03e48a8d7101df.png)

---

<div class="post-metadata">

### Author: ![Gio\_C](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/gio_c/32/5063_2.png) [@Gio\_C](https://discourse.mc-stan.org/u/Gio_C)
#### Post date: [June 11, 2019, 5:30pm UTC](https://discourse.mc-stan.org/t/rtools-not-properly-detected-in-r3-6-0-under-windows-10/9075/7 "2019-06-11T17:30:52Z")

</div>

Had the exact same problem - solved it for me as well. Many thanks, Seb.

It took me HOURS to get to a solution - what is the problem with R 3.6, Rtools, and Stan not playing well with each other? I’d like to try and avoid these issues at work in the future, as it caused considerable downtime for my team.

---

<div class="post-metadata">

### Author: ![Jonathan\_Mitchell](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jonathan_mitchell/32/6236_2.png) [@Jonathan\_Mitchell](https://discourse.mc-stan.org/u/Jonathan_Mitchell)
#### Post date: [June 11, 2019, 6:58pm UTC](https://discourse.mc-stan.org/t/rtools-not-properly-detected-in-r3-6-0-under-windows-10/9075/8 "2019-06-11T18:58:50Z")

</div>

I’ve been fighting with conflicts resulting from updating to R 3.6 for days now. Specifically, when fitting models using brms that include group variables, my R just dies without a message. rstanarm functions seem to work fine, though.

Just tried this, and it still isn’t working properly for me, unfortunately. It seems a lot of people are having this 3.6/rstan/Windows 10 conflict.
