cmdstanr icon indicating copy to clipboard operation
cmdstanr copied to clipboard

Skip CmdStan check for exe files

Open ankane opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Hi, thanks for this project!

I'd like to load/run a precompiled model without CmdStan being installed.

library(cmdstanr)

model <- cmdstan_model(exe_file="bernoulli")

However, this currently fails with:

Error: CmdStan path has not been set yet. See ?set_cmdstan_path.

Describe the solution you'd like

No error with the code above, like with CmdStanPy

from cmdstanpy import CmdStanModel

model = CmdStanModel(exe_file='bernoulli')

Describe alternatives you've considered

I tried setting the path to a non-existent path (to hack around this), but it fails as well.

ankane avatar May 02 '22 00:05 ankane

Hey @ankane,

we can definitely remove this constraint (having to have cmdstan installed), the problem is that we would then need to make sure that the user does have a system-installed TBB. Because otherwise, this won't work - we dynamically link TBB to the CmdStan executable.

If we have a simple way of checking whether the user has system TBB installation, I agree that we should do this.

rok-cesnovar avatar May 02 '22 11:05 rok-cesnovar

Thanks for the quick response @rok-cesnovar. I think the simplest and least error-prone way would be to run the program (since the linked TBB could be in any location).

If you still wanted to support friendly error messages, you could check any errors to see if they're TBB-related and show a custom error message (I've taken a similar approach in Ruby with libomp with some of my projects).

ankane avatar May 02 '22 16:05 ankane