Issue setting cmdstan path default

Hello,

As the title suggests really – I’ve had to manually download cmdstan due to some problems with the firewall on my work computer. At the moment I have to set the cmdstan path at the start of every session and I am trying to work out how to configure cmdstanr so that I don’t need to do this - so that it looks in the right place automatically.

Currently the cmdstan installation is located in a folder in the home directory, ‘~/cmdstan’, and it seems to work fine – I can load cmdstanr and, once I set the path to cmdstan, can then compile and fit models without any obvious problems. However, when I tried running cmdstan_default_path(dir="C:\\Users\\hf01\\Documents\\cmdstan") it returned the following error message: Error in if (endsWith(path, "/")) { : missing value where TRUE/FALSE needed.

I also thought maybe instead of setting the path to where the installation is, I could try moving the cmdstan installation to where cmdstanr is currently looking – which I think by default is ‘~/.cmdstan’. However, then loading cmdstanr (library(cmdstanr)) fails with a very similar error message: Error: package or namespace load failed for ‘cmdstanr’: .onLoad failed in loadNamespace() for 'cmdstanr', details: call: if (endsWith(path, "/")) { error: missing value where TRUE/FALSE needed.

This is all on a windows machine, R 4.3.2 and Rstudio 2023.12.0.369, and with the latest version of cmdstanr. The manual install I got by following the instructions for installation via conda (1 CmdStan Installation | CmdStan User’s Guide) in the cmdstan guide, and then copying the relevant folder across to my home directory.

Many thanks in advance for your help and do let me know if there’s any other info that you need.

Hugo

Just a follow-up to say that I no longer need to solve this problem as my IT guys at work were able to fix the issue with the firewall so I could install cmdstan the normal way. Happy for this to be deleted or left up, depending on whether it’s useful for others to see the original question?

Hugo

Glad you got it sorted out.

I’m not entirely sure if this would have solved your problem initially, but another way to set the path is to have an environment variable CMDSTAN that contains the path you need and cmdstanr will use that to look for the CmdStan installation without you having to call set_cmdstan_path().