Menu

I cannot use the package rjags on my MacBook

Help
Mari
2014-09-10
2018-01-07
  • Mari

    Mari - 2014-09-10

    I saw that now we have available the package rjags for Mavericks, but I cannot use it.
    My computer allows me to install, but to use the program, it gives me the following message:

    Loading the package

    library("rjags", lib.loc="/Library/Frameworks/R.framework/Versions/3.1/Resources/library")
    Error : .onLoad failed in loadNamespace() for 'rjags', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so':
    dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so, 10): Symbol not found: ZN5RangeC1ERKNSt316vectorIiNS0_9allocatorIiEEEES6_
    Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so
    Expected in: /usr/local/lib/libjags.3.dylib
    in /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so
    Error: package or namespace load failed for ‘rjags’

    Someone can help me? I don't have to much experience with R.
    Many thank you

     
  • Martyn Plummer

    Martyn Plummer - 2014-09-10

    You need to install the new JAGS-Mavericks-3.4.0.dmg file to go with the new rjags package. If you use the old Snow Leopard build of JAGS then you get that "Symbol not found" message. This is due to a change in the C++ library.

     
  • Mari

    Mari - 2014-09-11

    Martyn Plummer many thank you for your answer.
    I already try to install JAGS-Mavericks-3.4.0.dmg, but I always receive this message:

    tar: Unrecognized archive format
    tar: Error exit delayed from previous errors.
    Warning in install.packages :
    'tar' returned non-zero exit code 1
    Error in install.packages : file ‘~/Downloads/JAGS-Mavericks-3.4.0.dmg’ is not an OS X binary package

     
  • Martyn Plummer

    Martyn Plummer - 2014-09-11

    The error message tells you that JAGS-Mavericks-3.4.0.dmg is not an OS X binary package. It's a disk image. Mount it by double-clicking on the icon, then follow the instructions in the Readme.rtf file that you will find inside the mounted image.

     
  • Mari

    Mari - 2014-09-11

    Many thank you Martyn Plummer!!!

    I was desperate with this!

     
  • Ann Raiho

    Ann Raiho - 2014-09-25

    I'm having a problem installing the JAGS-Mavericks-3.4.0.dmg file. I downloaded it then installed it on my hard drive, but it's still just a disk image on my desktop. I still can't get rjags to work. I'm getting the same error that Mari is got when she first posted. I must be doing something wrong with the installation process?

     

    Last edit: Ann Raiho 2014-09-25
  • Martyn Plummer

    Martyn Plummer - 2014-09-25

    You need to have the right combination of R and JAGS. See here:

    http://martynplummer.wordpress.com/2014/09/08/jags-3-4-0-for-mavericks/

    Once you have the right combination, follow the instructions in my post to Mari on 2014-09-11 in this thread.

     
  • Matt Denwood

    Matt Denwood - 2014-09-25

    I assume you mean this error:

    Error : .onLoad failed in loadNamespace() for 'rjags', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object
    .... etc

    If so, then you are almost certainly trying to use the Mavericks version of JAGS with the Snow Leopard version of R (or vice versa). Note that there are two builds of JAGS 3.4.0 available from the files page:
    https://sourceforge.net/projects/mcmc-jags/files/JAGS/3.x/Mac%20OS%20X/

    There are more details in the read me file (there is one in the DMG you downloaded, and another on the files page above).

    When you say "it's still just a disk image on my desktop" - JAGS is installed as a command line utility, so it won't show up in /Applciations - but you can run it independently of R using Terminal.

    Matt

    EDIT: Martyn beat me to it :)

     

    Last edit: Matt Denwood 2014-09-25
  • mzz29

    mzz29 - 2016-08-30

    After updating R (3.3.1), Rstudio (0.99.903), JAGS (3.4.0), and rjags (4-6), I get the following error message:

    library(rjags)
    Error : .onLoad failed in loadNamespace() for 'rjags', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rjags/libs/rjags.so':
    dlopen(/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rjags/libs/rjags.so, 10): Library not loaded: /usr/local/lib/libjags.4.dylib
    Referenced from: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rjags/libs/rjags.so
    Reason: image not found
    Error: package or namespace load failed for ‘rjags’

    I downloaded JAGS-Mavericks-3.4.0, which should be right:

    .Platform$pkgType
    [1] "mac.binary.mavericks"

    I'd really like (r)jags to work again!

     
  • Martyn Plummer

    Martyn Plummer - 2016-08-30

    The rjags_4-6 package will not work with JAGS 3.4.0. You need to install JAGS 4.0.0 or higher. The latest release is 4.2.0.

     
    • mzz29

      mzz29 - 2016-08-31

      Thanks a lot! I don't know why I thought I had the latest release, but it works now!

       
  • hd255

    hd255 - 2016-09-28

    I am receiving the same error. I have the newest version of R(3.3.1) and downloaded the newest version of JAGS(4.2.0) and rjags(4-6). I'm running Max OS X El Cap on a 2010 Macbook Pro.

    I've tried reinstalling JAGS, reinstalling rjags, and reinstalling R. I've also reset my CRAN mirror.

    In R, I'm inputting:

    install.packages('rjags')
    

    trying URL 'https://cran.cnr.berkeley.edu/bin/macosx/mavericks/contrib/3.3/rjags_4-6.tgz'
    Content type 'application/x-gzip' length 249529 bytes (243 KB)
    ==================================================
    downloaded 243 KB

    The downloaded binary packages are in
    /var/folders/vr/82gfmc3s3k75p5yswb54c2f00000gn/T//RtmpGvJWYD/downloaded_packages

    library(rjags)
    

    Error : .onLoad failed in loadNamespace() for 'rjags', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rjags/libs/rjags.so':
    dlopen(/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rjags/libs/rjags.so, 10): Library not loaded: /usr/local/lib/libjags.4.dylib
    Referenced from: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rjags/libs/rjags.so
    Reason: no suitable image found. Did find:
    /usr/local/lib/libjags.4.dylib: stat() failed with errno=13
    /usr/local/lib/libjags.4.dylib: stat() failed with errno=13
    Error: package or namespace load failed for ‘rjags’

    I have also tried installing from the rjags source file:

    install.packages('~/Downloads/rjags_4-6.tar.gz', repos = NULL, type="source")
    

    But still get the same error message.

    Any thoughts?

     
    • Martyn Plummer

      Martyn Plummer - 2016-09-29

      This message:

      /usr/local/lib/libjags.4.dylib: stat() failed with errno=13
      

      means that the file exists, but you do not have correct permissions. Try

      chmod 755 /usr/local/lib
      

      as super user.

       
  • hd255

    hd255 - 2016-09-29

    Thank you, thank you, thank you! Going through the Terminal did not work for some reason, but I was able to change it using the Finder.

     
  • Sherrie Chambers

    Hey guys, I am having the same problem with this.

    I've checked all versions etc and tried going through Terminal with the above command but still can't get it to work... although I am a complete novice at using Terminal. Could you let me know how you did it through Finder please? Any advice would be appreciated!

     
  • Sherrie Chambers

    All good - looks like I managed to solve the issue. Cheers

     
  • laura

    laura - 2018-01-07

    Hello
    I am having trouble to load the rjags package on R 3.4.3. The package had downlaoded properly as i can see it on the right side of the RStudio but I am unable to load it

    Error: package or namespace load failed for ‘rjags’:
    .onLoad failed in loadNamespace() for 'rjags', details:
    call: packageVersion(pkg, lib)
    error: package ‘rjags’ not found

    I tried to uninstall R and JAGS multiple times and dowload different versions of JAGS (3 and 4) but none seem to change anything.

    I tried
    devtools::install_url("http://sourceforge.net/projects/mcmc-jags/files/rjags/4/rjags_4-4.tar.gz",
    args="--configure-args='--with-jags-include=/Users/casallas/homebrew/opt/jags/include/JAGS
    --with-jags-lib=/Users/casallas/homebrew/opt/jags/lib'")
    But I get :
    Installation failed: Command failed (1)

    I have also tried installing from the rjags source file:
    install.packages('~/Downloads/rjags_4-6.tar.gz', repos = NULL, type="source")
    But still get the same error message.

    Any ideas?
    Thanks

     

Log in to post a comment.