Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installation of package ‘rjags’ had non-zero exit status

Tags:

r

jags

S.O.: Linux Ubuntu 14.04 LTS R: R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-bit)

When I try to install the package rjags, I get the following fatal error:

install.packages("rjags")
Installing package into ‘/home/marco/.rkward/library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://mirrors.softliste.de/cran/src/contrib/rjags_3-15.tar.gz'
Content type 'application/x-gzip' length 66879 bytes (65 KB)
==================================================
downloaded 65 KB

* installing *source* package ‘rjags’ ...
** package ‘rjags’ successfully unpacked and MD5 sums checked
checking for prefix by checking for jags... no
configure: error: "Location of JAGS headers not defined. Use configure arg '--with-jags-include' or environment variable 'JAGS_INCLUDE'"
ERROR: configuration failed for package ‘rjags’
* removing ‘/home/marco/.rkward/library/rjags’

The downloaded source packages are in
    ‘/tmp/RtmpditLat/downloaded_packages’
Warning message:
In install.packages("rjags") :
  installation of package ‘rjags’ had non-zero exit status

Apparently, the first error message is

configure: error: "Location of JAGS headers not defined. Use configure arg '--with-jags-include' or environment variable 'JAGS_INCLUDE'"

How can I solve this?

like image 308
Marco Scazzocchio Avatar asked Aug 31 '15 08:08

Marco Scazzocchio


1 Answers

As a top comment explained, you need JAGS (Just Another Gibbs Sampler) to be installed in your system. Since you're using Ubuntu 14.04, running

sudo apt-get install jags

should be enough. However, in case you're in another distribution (or, for some reason, the code above doesn't work for you), it's a good idea to know how to get JAGS from the source:

  1. Access http://mcmc-jags.sourceforge.net/
  2. Look for the proper version under "Downloads". For instance, Fedora users should look into the Fedora_20 folder of http://download.opensuse.org/repositories/home:/cornell_vrdc/
  3. Don't forget to download both the base as well as the devel versions.

After the installation is successful, you can go back to R (which can stay open during the whole thing, anyway) and install the package you want.

like image 68
Waldir Leoncio Avatar answered Sep 23 '22 21:09

Waldir Leoncio