Building R Package that uses Stan - Running Multiple Chains Error


#1

I’m building a test package in R using Stan. I can run my model fine with one chain. However, when I run more than one chain (with multiple cores) I get the message below (my model is called model_logistic and StanTest is the package name) for each newly created worker:

Warning: namespace ‘StanTest’ is not available and has been replaced
by .GlobalEnv when processing object ‘’
Error in checkForRemoteErrors(val) :
5 nodes produced errors; first error: object ‘model_logistic’ not found

I tried building and reloading as described in the link below but that didn’t work.

https://groups.google.com/forum/#!topic/stan-users/8snqQTTfWVs


#2

Yeah, this happens when there are multiple versions of the package installed or there is something in data/ or sysdata.rda that causes the package to be loaded wrong on the nodes. Or you have weird paths on the computer you develop with.

If you have a link to the package repo, I can probably fix it.


#3

Thanks. Repo below, still very much a work in progress. Any suggestions welcomed, I changed the name of the repo so some files still have the old repo name, but that wasn’t the cause of this problem.

I also get the error below, although the program still runs.

Error in new_CppObject_xp(fields$.module, fields$.pointer, …) :
no valid constructor available for the argument list
trying deprecated constructor; please alert package maintainer

https://github.com/gdepalma/StanBayesErrorsMonoModels


#4

I got it to install after a bunch of build errors that should have already been overcome. But the package has no examples, so I can’t tell what is wrong with it.


#6

Thanks for your help, greatly appreciated.

I’ve updated all packages and am using R 3.4.2

I added a test file (…/test/test_example.R) to the repo. Everything works (except for the error below, but still works):

Error in new_CppObject_xp(fields$.module, fields$.pointer, ...) : 
  no valid constructor available for the argument list
trying deprecated constructor; please alert package maintainer

When I increase the chains to more than one in stan_logistic.fit.R I still get

 Error in checkForRemoteErrors(val) : 
  3 nodes produced errors; first error: object 'model_logistic' not found

#7

@bgoodri I made some changes to the repo (with test case) and was hoping you could provide any insights on why the multiple chains is not working. Thanks.