# Issue installing cmdstan

**URL:** <https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990>\
**Category:** Interfaces\
**Tags:** cmdstan, cmdstanr\
**Created:** [March 22, 2026, 1:04pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990 "2026-03-22T13:04:13Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattansb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mattansb/32/20280_2.png) [@mattansb](https://discourse.mc-stan.org/u/mattansb)\
**Post date:** [March 22, 2026, 1:04pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/1 "2026-03-22T13:04:13Z")

</div>

I’m trying to help my student install cmdstan through cmdstanr (on Windows) but keep getting the same error:

```R
library(cmdstanr)

check_cmdstan_toolchain()
#> The C++ toolchain required for CmdStan is setup properly!

install_cmdstan(cores = 2, overwrite = TRUE) # install CmdStan

```

Last couple of lines of output:

```no-highlight
  105 | #define TBB_VERSION_STRINGS TBB_VERSION_STRINGS_P(TBB)
      | ^ ~~~~~~~~~~~~~~~~~~~~../tbb_2020.3/src/tbb/tbb_misc.cpp:202:42: note: in expansion of macro 'TBB_VERSION_STRINGS'
  202 | static const char VersionString[] = "\0" TBB_VERSION_STRINGS;
      | ^ ~~~~~~~~~~~~~~~~~~
make[1]: Leaving directory '/c/Users/yahli/.cmdstan/cmdstan-2.38.0/stan/lib/stan_math/lib/tbb'
make[1]: *** [../tbb_2020.3/build/common_rules.inc:80: tbb_misc.o] Error 1
make: *** [stan/lib/stan_math/make/libraries:179: stan/lib/stan_math/lib/tbb/tbb.def] Error 2
make: *** Waiting for unfinished jobs....

Warning message:
There was a problem during installation. See the error message(s) above. 

```

```R
fit_logit <- cmdstanr_example("logistic", force_recompile = TRUE, quiet = FALSE)

```

```no-highlight
Compiling Stan program...
INFO: Could not find files for the given pattern(s).

INFO: Could not find files for the given pattern(s).

C
:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: cannot find -ltbb: No such file or directory
C:\rtools45\x8
6_64-w64-mingw32.static.posix\bin/ld.exe: cannot find stan/lib/stan_math/lib/tbb/tbb.dll: No such file or directory

collect2.exe: error: ld returned 1 exit status

make: *** [make/program:82: C:/Users/yahli/AppData/Local/Temp/RtmpItUWJj/model-670470cb6958.exe] Error 1

Error: An error occured during compilation! See the message above for more information.

```

Any help is appreciated!

---

<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:** [March 22, 2026, 8:11pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/2 "2026-03-22T20:11:21Z")

</div>

I don’t know much about Windows TBB issues, so hopefully @WardBrian or someone else can chime in here. But I think some of the important output may come earlier in the installation output, not just the last few lines. Earlier in the output were there any TBB related error messages?

Also, one important question:

Is the cmdstanr installation from the “release” on r-universe (e.g. installed via `install.packages(“cmdstanr”, repos = c(‘``https://stan-dev.r-universe.dev``’, getOption(“repos”)))`) or was it installed from Github (e.g. via `remotes::install_github` or `pak::pak`)? If it was installed from GitHub, how recently was it installed? We very recently (~5 days ago) merged a pull request that affects how the toolchain is handled on Windows, so it would be good to know how cmdstanr was installed and when.

---

<div class="post-metadata">

**Author:** ![mattansb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mattansb/32/20280_2.png) [@mattansb](https://discourse.mc-stan.org/u/mattansb)\
**Post date:** [March 23, 2026, 5:54am UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/3 "2026-03-23T05:54:54Z")

</div>

It was installed from r-universe (but so did other students, who didn’t have this issue- should she try with pak?

As far as I could tell there were no errors regarding TBB during installation, but I’ll try and get the full installation output.

---

<div class="post-metadata">

**Author:** ![drezap](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/drezap/32/11168_2.png) [@drezap](https://discourse.mc-stan.org/u/drezap)\
**Post date:** [March 23, 2026, 2:12pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/4 "2026-03-23T14:12:30Z")

</div>

I think I had an issue with this. Go for command-line installations of the dependencies and make sure the versions are correct. [Stan Math Library: Stan Math Library Docs](https://mc-stan.org/math/) are the proper packages, and then you can use, on ubuntu, `sudo apt install blah blah`, or I was using WSL (windows subsystem for linux) and I think you can use the same commands, I don’t remember. If you’re on windows, WSL is like a separate VM, that operates like ubuntu. I think it also uses apt. So I would make sure the stan/math dependencies are there first and then try re-installing. Also make sure you have the rtools tool chains installed, stuff like that.

---

<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:** [March 23, 2026, 4:17pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/5 "2026-03-23T16:17:48Z")

</div>

> [@mattansb](#):
>
> It was installed from r-universe (but so did other students, who didn’t have this issue- should she try with pak?

They could try installing from GitHub and then restart R before trying to `install_cmdstan` again. I doubt that would fix it, but it shouldn’t hurt so maybe worth a shot.

Do you know if this is a personal computer or if it’s a managed university/work machine? If the former, it’s possible that just removing and reinstalling RTools could fix this. If the latter, it could be maybe be some policy/security restriction, but it’s hard to say just from that output.

---

<div class="post-metadata">

**Author:** ![mattansb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mattansb/32/20280_2.png) [@mattansb](https://discourse.mc-stan.org/u/mattansb)\
**Post date:** [March 23, 2026, 5:39pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/6 "2026-03-23T17:39:21Z")

</div>

I’m not a computer guy and have little confidence in my ability to do all of this on a student’s computer without causing damage :/

---

<div class="post-metadata">

**Author:** ![mattansb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mattansb/32/20280_2.png) [@mattansb](https://discourse.mc-stan.org/u/mattansb)\
**Post date:** [March 23, 2026, 5:41pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/7 "2026-03-23T17:41:47Z")

</div>

I’ll have her try pak.

It is a personal computer. She’s already removed and reinstalled RTools.

This is the full captured output from:

```R
capture.output({
    library(cmdstanr)

    check_cmdstan_toolchain()

    install_cmdstan(cores = 2, overwrite = TRUE) # install CmdStan

    fit_logit <- cmdstanr_example("logistic", force_recompile = TRUE, quiet = FALSE)
  },
  file = "log.txt")

```

[log.txt](https://discourse.mc-stan.org/uploads/short-url/yDGntO2Udv7dYsD80xGx16Eab8F.txt) (444.6 KB)

---

<div class="post-metadata">

**Author:** ![drezap](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/drezap/32/11168_2.png) [@drezap](https://discourse.mc-stan.org/u/drezap)\
**Post date:** [March 23, 2026, 7:51pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/8 "2026-03-23T19:51:43Z")

</div>

So I was running cmdstan on WSL, it operates like ubuntu, and then pulling the data onto the windows “partition” to analyze it.

I just went through this… I forget exactly what I did. Use WSL, and then do something like this:

[https://askubuntu.com/questions/1170054/install-newest-tbb-thread-building-blocks-on-ubuntu-18-04](https://askubuntu.com/questions/1170054/install-newest-tbb-thread-building-blocks-on-ubuntu-18-04).

And then there may be dependencies you have to add. Check out I think I had to add some additional repos for the package manager, and then there was additional tool chains that I had to install in order to get TBB to run with cmdstan properly. There’s a way to add another repo that aren’t on the stock `apt` package manager repos. I saved some references, but they’re not comprehensive.

And you may have to follow the paper trail, and add some additional toolchains, to get cmdstan to cooperate with WSL.

I would just keep looking up stuff on stackoverflow and technical documentation and keep installing stuff… if it says `cannot find xxx` go ahead and look it up install instructions on stack overflow.

WSL operates like ubuntu, it’s kinda like a virtual machine. Good luck. This took me a few days.

---

<div class="post-metadata">

**Author:** ![WardBrian](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wardbrian/32/12078_2.png) [@WardBrian](https://discourse.mc-stan.org/u/WardBrian)\
**Post date:** [March 23, 2026, 8:06pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/9 "2026-03-23T20:06:29Z")

</div>

Thanks for the full log. It appears there is an issue with the TBB build. Could you go to their cmdstan folder and get the contents of `CMDSTAN/stan/lib/stan_math/lib/tbb/version_string.ver`?

My hunch is that the first couple lines of this file will be missing a `"` (or possibly have too many), but I haven’t previously encountered this

---

<div class="post-metadata">

**Author:** ![mattansb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mattansb/32/20280_2.png) [@mattansb](https://discourse.mc-stan.org/u/mattansb)\
**Post date:** [March 25, 2026, 11:19am UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/10 "2026-03-25T11:19:08Z")

</div>

> [@WardBrian](#):
>
> Could you go to their cmdstan folder and get the contents of `CMDSTAN/stan/lib/stan_math/lib/tbb/version_string.ver`?

Here you go: [version\_string.ver.txt](https://discourse.mc-stan.org/uploads/short-url/qCVlU9AYEUSZO3ruaLTjdAlxKct.txt) (718 Bytes)

---

<div class="post-metadata">

**Author:** ![WardBrian](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wardbrian/32/12078_2.png) [@WardBrian](https://discourse.mc-stan.org/u/WardBrian)\
**Post date:** [March 25, 2026, 1:39pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/11 "2026-03-25T13:39:42Z")

</div>

Thanks, looks like my hunch was correct.

So, that file is generated by [this file](https://github.com/stan-dev/math/blob/develop/lib/tbb_2020.3/build/version_info_windows.js) in TBB’s build system. In particular, that line expands the Windows variable `%COMPUTERNAME%`. For some reason, on your student’s machine, this variable seems to be expanding to `%,?%`%"`, which has an extra `"` in it and is causing this headache.

The simplest thing to do is probably open that file in something like notepad, and change the first line to `#N ": BUILD_HOST\t\tMy Computer" ENDL \`

I’ve attached a version with this string changed, which you can drag-and-drop (remember to rename it without the `.txt` suffix the forums requires)

[version\_string.ver.txt](https://discourse.mc-stan.org/uploads/short-url/aB9JNOF7RCMyXZWRuQphsVEhIv1.txt) (722 Bytes)

This is a first for me, so if the student is patient enough, I’d be really curious what the result of `echo: %COMPUTERNAME%` is in a command prompt.

---

<div class="post-metadata">

**Author:** ![mattansb](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mattansb/32/20280_2.png) [@mattansb](https://discourse.mc-stan.org/u/mattansb)\
**Post date:** [March 29, 2026, 1:27pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/12 "2026-03-29T13:27:42Z")

</div>

Using the `version_string.ver` file you provided seemed to have fixed _that_ error but we still got another (different one?)

Anyway, her computer name was `‰„‰‘‰“` which I’m guessing was because the name as it appeared in the _Settings \> System \> About_ was comprised of non-ASCII characters?

So changing the computer name fixed it!

Thanks for all your help!

---

<div class="post-metadata">

**Author:** ![WardBrian](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/wardbrian/32/12078_2.png) [@WardBrian](https://discourse.mc-stan.org/u/WardBrian)\
**Post date:** [March 29, 2026, 1:32pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/13 "2026-03-29T13:32:26Z")

</div>

> [@mattansb](#):
>
> was comprised of non-ASCII characters

This was sort of what I figured might be happening. While I’ve never seen it crop up specifically here, the Windows support for non-ascii code pages has a near endless number of edge cases in situations like this. Unfortunately our (and a lot of open source in general) coverage of Windows developers is sparse, and so the odds of us seeing this kind of thing before a user does is super low.

Thank you for your (and your student’s) patience!

---

<div class="post-metadata">

**Author:** ![drezap](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/drezap/32/11168_2.png) [@drezap](https://discourse.mc-stan.org/u/drezap)\
**Post date:** [March 30, 2026, 4:06am UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/14 "2026-03-30T04:06:16Z")

</div>

I got cmdstan to work fine with WSL. I’m installing rstudio and then rstan through WSL on windows and it’s working fine. Some dependencies to install, but this is cool. It’s like Ubuntu

---

<div class="post-metadata">

**Author:** ![drezap](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/drezap/32/11168_2.png) [@drezap](https://discourse.mc-stan.org/u/drezap)\
**Post date:** [April 1, 2026, 5:45pm UTC](https://discourse.mc-stan.org/t/issue-installing-cmdstan/40990/15 "2026-04-01T17:45:34Z")

</div>

So I’ll stop spamming this thread, but there’s issues with using git and WSL, there’s a bug report, and the recursive option doesn’t work (and some missing directories or files). So for cloning, I’m using MINGW64 terminal, and then I’m copying it over to WSL to run, because I couldn’t get make to work on MINGW64. And I think I had to install sundails, tbb from source on WSL to get cmdstan to run. Just in case this helps anyone.
