Marco Scazzocchio
Marco Scazzocchio

Reputation: 61

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

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?

Upvotes: 6

Views: 7799

Answers (3)

erptocoding
erptocoding

Reputation: 383

1) If necessary Download and install R (https://www.r-project.org/) and potentially a user interface to R like R Studio (see here for tips on getting started with R). 2) Download and install JAGS as per operating system requriements. (http://mcmc-jags.sourceforge.net/) 3) Install additional R packages: e.g., in R install.packages("rjags") . In particular, I use the packages rjags to interface with JAGS and coda to process MCMC output.

Upvotes: 1

Juannes
Juannes

Reputation: 89

To me, first, I worked with the installation jags by terminal:

sudo apt-get install jags 

and then

install.packages("rjags") 

And the error was gone.

Upvotes: 3

Waldir Leoncio
Waldir Leoncio

Reputation: 11371

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.

Upvotes: 6

Related Questions