# Problem with cmdstanr

**URL:** <https://discourse.mc-stan.org/t/problem-with-cmdstanr/29629>\
**Category:** General\
**Created:** [November 28, 2022, 2:13pm UTC](https://discourse.mc-stan.org/t/problem-with-cmdstanr/29629 "2022-11-28T14:13:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ana123](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ana123/32/13350_2.png) [@Ana123](https://discourse.mc-stan.org/u/Ana123)\
**Post date:** [November 28, 2022, 2:13pm UTC](https://discourse.mc-stan.org/t/problem-with-cmdstanr/29629/1 "2022-11-28T14:13:29Z")

</div>

I have a problem with cmdstan

This command check\_cmdstan\_toolchain(fix = TRUE, quiet = FALSE) gives the following output:

## Installing mingw32-make and g++ with Rtools42. Error in `processx::run("pacman", args = c("-Sy", install_pkgs, "--noconfirm"), …`: ! System command ‘pacman’ failed

Exit status: 1  
Stderr:  
error: failed to synchronize all databases (unable to lock database)

Thank you for yout help

---

<div class="post-metadata">

**Author:** ![jonathan-g](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jonathan-g/32/15494_2.png) [@jonathan-g](https://discourse.mc-stan.org/u/jonathan-g)\
**Post date:** [December 4, 2022, 4:48pm UTC](https://discourse.mc-stan.org/t/problem-with-cmdstanr/29629/2 "2022-12-04T16:48:21Z")

</div>

The advice in a comment by CLRafaelR to [GitHub Issue #653](https://github.com/stan-dev/cmdstanr/issues/653) has been helpful to many people who run into this problem.

> <https://github.com/stan-dev/cmdstanr/issues/653#issuecomment-1257127097>
>
> \*\*Describe the bug\*\*
> Installing CmdStan from CmdStanR 0.5.2 with R4.2 on Window…s 11 fails.
> 
> \*\*To Reproduce\*\*
> 
> Create a new project and run:
> \`\`\`
> cmdstanr::check\_cmdstan\_toolchain(fix = TRUE)
> cmdstanr::install\_cmdstan()
> \`\`\`
> 
> Console output in R Studio:
> \`\`\`
> The C++ toolchain required for CmdStan is setup properly!
> \* Latest CmdStan release is v2.29.2
> \* Installing CmdStan v2.29.2 in E:/Documents/.cmdstan/cmdstan-2.29.2
> \* Downloading cmdstan-2.29.2.tar.gz from GitHub...
> \* Download complete
> \* Unpacking archive...
> Warning: cannot open file 'E:/Documents/.cmdstan/cmdstan-2.29.2/make/local': No such file or directory
> \`\`\`
> 
> If I look at the directory structure of the unpacked archive (from the install attempt), the issue seems to be that 'cmdstan-2.29.2' is repeated twice in the path: the content of CmdStan is located at ‘E:/Documents/.cmdstan/cmdstan-2.29.2/cmdstan-2.29.2/’, which would explain why the make/local is not found since it assumes 'cmdstan-2.29.2' only exists once in the path.
> 
> \*\*Operating system\*\*
> Windows 11
> 
> \*\*CmdStanR version number\*\*
> 0.5.2
> 
> \*\*Additional context\*\*
> I do not think this issue is W11 specific since I always had issues installing CmdStan using CmdStanR (even when still on W10). Not sure it was exactly the same issue I had back then though, but I think it was.
