Cmdstanr unusual error message

I have reinstalled R, Rstudio and Rtools to use cmdstanr (to later use the newest rethinking package). But I get a weird error message and I can’t find solution elsewhere, although the same error is reported on this page but it has no answer.

I have followed this guide and everything seems to work. When I enter R and run the following piece of code, everything is still working.

file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
mod <- cmdstan_model(file)
mod$print()

But then, when I try to run a toy model or even a real one from rethinking book, I get the same error as on the StackOverflow page (first hyperlink above):

Error in data.table::fread(cmd = fread_cmd, colClasses = "character",  : 
  File 'C:\Users\LENOVO\AppData\Local\Temp\RtmpoDe8x4\file29f43d9a39f7' does not exist or is non-readable. getwd()=='C:/Users/LENOVO/Documents'

I was suspicious of data.table package and deleted it completely, restarted R and tried running same thing again and it didn’t help although the error message changed:

Error in loadNamespace(x) : no package called 'data.table'

Hey,

lets continue the discussion here: Problem with running cmdstanr: Error in data.table::fread(cmd = fread_cmd, colClasses = "character", : · Issue #618 · stan-dev/cmdstanr · GitHub

Will post the final resolution here, once we get to it.

1 Like