Problem using cmdstanr_write_stan_file_dir with brms

I am trying to add the option of specifying the cmdstanr_write_stan_file_dir option in my code and am running into problems. I am on linux, which might be relevant for path handling?

What I currently do is to just set options(cmdstanr_write_stan_file_dir = some_path) and fit brms models as usual.
However, I get a file '~/Documents/[...]' not found or cannot be opened error from stanc. After some digging it seems that stanc does not like paths that start with ~/.... At least when trying around in my terminal I got the same error for when using ~/... while /home/user/... did not throw the problem.

Now I thought I had the error figured and all I had to do was putting the right path format in the option. But it seems that brms is using a ~/... path regardless.

If anyone here sees an obvious mistake on my end before I step through the entire brm call that’d help a lot :)

Thanks for the bug report!

Can you try to install


and try again? Corresponding PR Fix use of tilde with cmdstanr_write_stan_file_dir by rok-cesnovar · Pull Request #665 · stan-dev/cmdstanr · GitHub

1 Like

I tried with both path formats and both work :) Thanks for the quick fix.

1 Like