Issue with cmdstanr toolchain - MSYS2 development key

Hello! I have recently run into a problem with trying to install the cmdstanr package in R, specifically setting up the cmdstan toolchain.

Essentially, I use the cmdstanr backend to fit MCMC using the brms package, and I do this across multiple machines. With recently updating to R 4.4.1, I had an issue using cmdstanr across my machines and followed this advice to get it working again.

However, on one of my machines I run into the following problem when trying to run the function check_cmdstan_toolchain(fix = TRUE) .

> cmdstanr::check_cmdstan_toolchain()
Error: 
Rtools44 installation found but the toolchain was not installed.
Run cmdstanr::check_cmdstan_toolchain(fix = TRUE) to fix the issue.
> # if error, try:
> cmdstanr::check_cmdstan_toolchain(fix = TRUE)
Installing mingw32-make and g++ with Rtools44
Error in `processx::run("pacman", args = c("-Sy", install_pkgs, "--noconfirm"), …`:
! System command 'pacman' failed
---
Exit status: 1
Stderr (last 10 lines, see `$stderr` for more):
error: clang64: signature from "Christoph Reiter (MSYS2 development key) <reiter.christoph@gmail.com>" is unknown trust
error: msys: signature from "Christoph Reiter (MSYS2 development key) <reiter.christoph@gmail.com>" is unknown trust
...

This continues on for several more lines, all with the same “unknown trust” error. I have tried searching around for some solutions, including following examples from here to update MSYS2 and refresh keys. What I have been able to run in MSYS2 directly suggests that these packages are all up to date and that the keys do not need to be updated because they have not changed.

I will note that this issue does not occur on my two personal machines - it’s my office computer where this is a problem, but has not been an issue in the past. I am able to fit MCMC using brms but with rstan as the backend.

I apologize if this is a mundane question, but I am a mere mortal who greatly appreciates these software tools and their utility for my work - thanks so much for your consideration.

1 Like

@jrydberg : I have the exact same issue, did you find a workaround?

Sorry this is so painful. We try to make it as pain free as possible, but the issue is not that these problems are mundane, but that they’re exotic in multiple different ways as you can see from it working on some machines and not on others.

@Jonah or @andrjohns or @bgoodri might be able to help on the R side.

Can you install Rtools44 on the machine manually following the instructions from R?

https://cran.r-project.org/bin/windows/Rtools/rtools44/rtools.html

Thanks so much for getting back to me. I’ve just been using my other machines in the meantime and I didn’t look back to see if someone replied.

I can confirm that I have RTools 4.4 installed. It is in the default location recommended C:\rtools44.

When I run the check_cmdstan_toolchain() I receive the message that rtools installation was found but the toolchain was not installed, which then still leads to the error I note above when I try the fix = TRUE argument.

@anthony_462 were you able to arrive at a solution?

If @Jonah @andrjohns or @bgoodri have any thoughts about maybe something I doing wrong on the R side, I would appreciate it.

Thanks again for your time and consideration

Hi @jrydberg, I somewhat managed to arrive at a solution. I simply opened MSYS2 exe file and then it was able to recognise the “pacman” package and check the toolchains. I’m still confused because I thought I had already tried that previously without success, but now it seems to work.