[R] rjags cannot find JAGS-4.0.0

Martyn Plummer plummerm at iarc.fr
Mon Nov 30 19:09:16 CET 2015


On Fri, 2015-11-27 at 11:27 -0800, David Winsemius wrote:
> > On Nov 26, 2015, at 4:59 PM, Margaret Donald <merricks.merricks at gmail.com> wrote:
> > 
> > 1. Despite being in R with administrative rights  the library "rjags" loads
> > in a temporary location.
> > 
> >> install.packages("rjags", dependencies=TRUE,
> > +       lib= "C:/Users/Margaret Donald/Documents/R/win-library/3.2")
> > trying URL 'https://cran.r-project.org/bin/windows/contrib/3.2/rjags_4-4.zip
> > '
> > Content type 'application/zip' length 525871 bytes (513 KB)
> > downloaded 513 KB
> > 
> > package ‘rjags’ successfully unpacked and MD5 sums checked
> > 
> > The downloaded binary packages are in
> >        C:\Users\Margaret
> > Donald\AppData\Local\Temp\RtmpMzv76s\downloaded_packages
> 
> That’s not an indication of an error. The installation process always does that.
> 
> 
> > #-----------------------------------------------------------------------------------------------------------------
> > 
> > 2. Cannot find JAGS-4.0.0 which is in C;\programs\JAGS\JAGS-4.0.0.  How do
> > I get R to see JAGS-4.0.0

The Windows installer writes some keys in the Windows registry. These
keys are then read by the rjags package when it is loaded to locate the
JAGS DLL.

I don't know why this is not working in your case. You might try
uninstalling and reinstalling JAGS (and by this I mean that the user who
installed it should uninstall it from the Control Panel).

Otherwise, as David says, you can set the environment variable
JAGS_HOME. Note that if you previously set JAGS_HOME in .Rprofile and
have upgraded to a new version of JAGS, then JAGS_HOME will be pointing
to the wrong place. This might explain why rjags cannot find JAGS and
this is why I do not recommend this solution except as a last resort.

> You might try to use Sys.setenv to create a properly directed JAGS_HOME
> 
> Sys.setenv(JAGS_HOME=“C:\programs\JAGS\JAGS-4.0.0”)
> 
> (I corrected the semi-colon.) 
> >> library(rjags)
> > Error : .onLoad failed in loadNamespace() for 'rjags', details:
> >  call: fun(libname, pkgname)
> >  error: Failed to locate any version of JAGS version 4
> > 
> > The rjags package is just an interface to the JAGS library
> > Make sure you have installed JAGS-4.x.y.exe (for any x >=0, y>=0) from
> > http://www.sourceforge.net/projects/mcmc-jags/files
> 
> I’m was having a perhaps similar problem on a Mac. The binary version
> 3-15 of rjags installed today from CRAN was trying to
> access /usr/local/lib/libjags.3.dylib, but since I have installed JAGS
> version 4.0.1 installed from the SourceForge repository, there is no
> ligjags.3.dylib, but instead there was only
> a /usr/local/lib/libjags.4.dylib

rjags_4-4 requires JAGS 4.x.y and the previous version rjags_3-15 is not
compatible with JAGS 4.0.0. Unfortunately the Mac OS X binaries on CRAN
are not up to date. I have no control over this but Matt Denwood has
made a binary for Mavericks or later available on Sourceforge:

http://sourceforge.net/projects/mcmc-jags/files/rjags/4/rjags_4-4.tgz

Martyn

> Going back to SourceForge and tracking down the older version of JAGS
> and installing version 3.4.0 was successful in getting rjags to load
> correctly. I suspect that with the release of JAGS v4 that there is
> some mismatch among the various editions of rjags and JAGS.
> 
>> David
> > 
> > Error: package or namespace load failed for ‘rjags’
> >> library(R2jags)
> > Loading required package: rjags
> > Error : .onLoad failed in loadNamespace() for 'rjags', details:
> >  call: fun(libname, pkgname)
> >  error: Failed to locate any version of JAGS version 4
> > 
> > The rjags package is just an interface to the JAGS library
> > Make sure you have installed JAGS-4.x.y.exe (for any x >=0, y>=0) from
> > http://www.sourceforge.net/projects/mcmc-jags/files
> > 
> > Error: package ‘rjags’ could not be loaded
> >> 
> > 
> > Regards,
> > Margaret Donald
> > -- 
> > Margaret Donald
> > Post Doctoral researcher
> > University of New South Wales
> > margaret.donald at unsw.edu.au
> > 0405 834 550
> > 
> > 	[[alternative HTML version deleted]]
> > 
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> David Winsemius
> Alameda, CA, USA
> 



More information about the R-help mailing list