# Error: No Rstan Package when using cmdstanr for brms

**URL:** <https://discourse.mc-stan.org/t/error-no-rstan-package-when-using-cmdstanr-for-brms/40280>\
**Category:** Interfaces\
**Tags:** brms\
**Created:** [August 25, 2025, 10:03pm UTC](https://discourse.mc-stan.org/t/error-no-rstan-package-when-using-cmdstanr-for-brms/40280 "2025-08-25T22:03:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![21\_Kiwis](https://avatars.discourse-cdn.com/v4/letter/2/8491ac/32.png) [@21\_Kiwis](https://discourse.mc-stan.org/u/21_Kiwis)\
**Post date:** [August 25, 2025, 10:03pm UTC](https://discourse.mc-stan.org/t/error-no-rstan-package-when-using-cmdstanr-for-brms/40280/1 "2025-08-25T22:03:38Z")

</div>

I keep getting this error “Error in utils::packageVersion(“rstan”) : there is no package called ‘rstan’“ but I have installed brms, cmdstanr, and run cmdstanr::install\_cmdstan(). I’ve also made sure to set the cmdstanr::set\_cmdstan\_path. My model refers to cmdstanr for the backend, but it looks like its still trying to pull up rstan.

```no-highlight
library(brms)
library(cmdstanr)
brms::brm(var1 ~ var2, 
          data = df, 
          family = hurdle_gamma(), 
          backend = "cmdstanr")

```

Operating System: Windows  
Interface Version: R 4.4.0

How do I get it to stop trying to find the rstan package version so it will run the brms model through cmdstanr?

---

<div class="post-metadata">

**Author:** ![jsocolar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jsocolar/32/2486_2.png) [@jsocolar](https://discourse.mc-stan.org/u/jsocolar)\
**Post date:** [August 25, 2025, 11:05pm UTC](https://discourse.mc-stan.org/t/error-no-rstan-package-when-using-cmdstanr-for-brms/40280/2 "2025-08-25T23:05:32Z")

</div>

`brms` imports `rstan`, so `rstan` needs to be installed even if you use the `cmdstanr` backend. If you re-install `brms`, it should prompt you to also install `rstan` if indeed you don’t have a working installation. Alternatively, you can just install `rstan` directly.

---

<div class="post-metadata">

**Author:** ![markpousee](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@markpousee](https://discourse.mc-stan.org/u/markpousee)\
**Post date:** [August 26, 2025, 12:21pm UTC](https://discourse.mc-stan.org/t/error-no-rstan-package-when-using-cmdstanr-for-brms/40280/3 "2025-08-26T12:21:59Z")

</div>

This happens because some versions of brms still check for rstan when loading, even if you’re using cmdstanr as backend. The fix is simple: install a lightweight rstan just to satisfy the dependency check, even if you won’t use it, with install.packages(“rstan”). After that, keep calling your models with backend = “cmdstanr”. If you don’t want to install rstan, you can instead update brms to the latest CRAN or development version (remotes::install\_github(“paul-buerkner/brms”)), which removes this requirement. [👊](https://powerhouseexpress.com.pk/collections/inverex-inverter)

---

<div class="post-metadata">

**Author:** ![21\_Kiwis](https://avatars.discourse-cdn.com/v4/letter/2/8491ac/32.png) [@21\_Kiwis](https://discourse.mc-stan.org/u/21_Kiwis)\
**Post date:** [August 26, 2025, 3:04pm UTC](https://discourse.mc-stan.org/t/error-no-rstan-package-when-using-cmdstanr-for-brms/40280/4 "2025-08-26T15:04:16Z")

</div>

Thanks for the reply. Trying to update to the new development version is still requiring rstan. Unfortunately, I was having issues installing rstan due to server restrictions on downloading Rtools (which resulted in errors about compiling). I will see if I can get new permissions to get Rtools and then rstan.
