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?
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:
Access http://mcmc-jags.sourceforge.net/
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/
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.
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.
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.
Related
My R console is 3.5.1. I want to install the rattle package on my Mac Mojave 10.14.1. I realize that you have to install RGtk2 first but still got error messaging even when loaded "from source"
> install.packages("RGtk2")
--- Please select a CRAN mirror for use in this session ---
Package which is only available in source form, and may need
compilation of C/C++/Fortran: ‘RGtk2’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘RGtk2’
trying URL 'https://mirrors.nics.utk.edu/cran/src/contrib/RGtk2_2.20.35.tar.gz'
Content type 'application/x-gzip' length 2793137 bytes (2.7 MB)
==================================================
downloaded 2.7 MB
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... no
checking for INTROSPECTION... no
checking for GTK... no
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RGtk2’
The downloaded source packages are in
‘/private/var/folders/67/r1c_pfwn5ws6y7rsl2bp_qqh0000gn/T/Rtmpi55PMx/downloaded_packages’
Warning message:
In install.packages("RGtk2") :
installation of package ‘RGtk2’ had non-zero exit status
> install.packages("GTK")
Warning message:
package ‘GTK’ is not available (for R version 3.5.1)
> install.packages("RGtk2", dependencies=TRUE)
Package which is only available in source form, and may need
compilation of C/C++/Fortran: ‘RGtk2’
Do you want to attempt to install these from sources? (Yes/no/cancel) no
This answer is a distillation of content I originally posted on my Johns Hopkins Data Science Specialization Community Mentor Github site in August 2017, in response to student questions about how to install Rattle on OS X in order to produce fancy rpart plots with rattle::fancyRpartPlot().
The install requires the gtk toolkit, and on the Mac one way to accomplish this is, per R 3.0 and GTK+ / RGTK2 Error:
Install macports — tool for installing mac packages
run SUDO to install gtk2 on mac sudo port install gtk2 ## (X11 -- not aqua)
export new path export PATH=/opt/local/bin:/opt/local/sbin:$PATH
From command line R, enter install rgtk2 with install.packages("RGtk2",type="source") to compile from source
Install the rattle packageinstall.packages("rattle",type="source")
NOTE: For the RGtk2 install to work correctly from RStudio, one must first confirm that the PATH change listed above is applied to the shell that is used to start RStudio.
The most complete set of instructions is located at Sebastian Kopf's Gist page and verified by my own install on June 17, 2017. Once installed, loading the rattle library will generate the following output in the R console.
In order to use fancyRpartPlot(), one will also need to install the rpart.plot package.
install.packages("rpart.plot")
Example: Fancy Rpart Plot of Iris Data
Here we've replicated the code needed to generate a fancy tree diagram with caret and rattle that is discussed in the Johns Hopkins Data Science Specialization Practical Machine Learning lecture on Predicting with Trees.
library(caret)
library(rattle)
inTrain <- createDataPartition(y = iris$Species,
p = 0.7,
list = FALSE)
training <- iris[inTrain,]
testing <- iris[-inTrain,]
modFit <- train(Species ~ .,method = "rpart",data = training)
fancyRpartPlot(modFit$finalModel)
I installed RStudio and R recently on a new laptop
I installed RTools after I noticed that my "packages" (it's source code) - was being downloaded in a temp. folder under "Users...\AppData\ etc. and I couldn't find the actual package and use them.
The RTools then builds the package from source - I think
This did not happen with my earlier RStudio and R isntalls. The packages were downloaded "cleanly" - I don't remember it going to through the source code build process
> install.packages("caret")
also installing the dependencies ‘nloptr’, ‘lme4’, ‘pbkrtest’, ‘car’
Packages which are only available in source form, and may need compilation of
C/C++/Fortran: ‘nloptr’ ‘lme4’ ‘caret’
Do you want to attempt to install these from sources?
When I say 'y' to this question - it builds it all right.
Versions:
OS: Windows 10
RStudio: 0.99.903
R: 3.3.1
(P.S. I have not been able to install the 'caret' package, the others I could going through this process.)
this worked for me:
I installed the package directly from the windows binary zip file:
LINK <- "https://cran.r-project.org/bin/windows/contrib/3.3/caret_6.0-71.zip"
install.packages(LINK, repos =NULL)
The links to binaries were found at: https://cran.r-project.org/
See under Software > R Binaries
url <- "http://cran.us.r-project.org/src/contrib/Archive/cldr/cldr_1.1.0.tar.gz"
pkgFile<-"cldr_1.1.0.tar.gz"
download.file(url = url, destfile = pkgFile)
Console
>trying URL 'http://cran.us.r-project.org/src/contrib/Archive/cldr/cldr_1.1.0.tar.gz'
Content type 'application/x-gzip' length 2296083 bytes (2.2 MB)
==============================
downloaded 2.2 MB
install.packages(pkgs = pkgFile, type = "source", repos = NULL)
> Installing package into ‘C: / Users / v - xuawan / Documents / R / win -
library / 3.2’
(as ‘lib’ is unspecified)
* installing * source * package 'cldr' ...
** package 'cldr' successfully unpacked and MD5 sums checked
** libs
> ** * arch - i386
Warning:running command 'make -f "Makevars" -f "C:/PROGRA~1/R/R-32~1.0/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-32~1.0/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="cldr.dll" ' had status 127
ERROR:compilation failed for package 'cldr'
* removing 'C:/Users/v-xuawan/Documents/R/win-library/3.2/cldr'
Warning in install.packages:running command '"C:/PROGRA~1/R/R-32~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\v-xuawan\Documents\R\win-library\3.2" "cldr_1.1.0.tar.gz"' had status 1
Warning in install.packages:installation of package ‘cldr_1.1.0.tar.gz’ had non -
zero exit status
I tried to install package cldr on windows.
I am wondering if any of you know how to solve above error message
Have you installed RTools?
Choose the right version, which belongs to your R version (it seems you use R 3.2)
From the 127 return code, it looks like you don't have a C++ compiler installed on your path. Have you installed the latest Rtools for Windows? It will give you the C++ toolchain you need.
Try this: install.packages("cldr", type="binary"). I was getting same error message for 'backports' package installation.
The same functions can be found in other packages now available on CRAN. They can be installed with the usual install.packages("cld2") and install.packages("cld3"):
cld2 - https://github.com/ropensci/cld2
cld3 - https://github.com/ropensci/cld3
For a quick comparison based on tweets, see this other answer: https://stackoverflow.com/a/46663823/4124601
I was having the same issue on R Cloud for 'raster' package, it's fixed when I've switched to Desktop R Studio. I've seen Desktop R studio downloads other required packages too before installing the one you wanted. I'm not sure if this's the exact case for you, but worth to try!
I would like to use functions in the mvpart package in R. I know it has been removed from CRAN, but I tried installing archive versions available here: http://cran.r-project.org/web/packages/mvpart/index.html
install.packages("D:/mvpart_1.6-2.tar.gz", repos = NULL, type = "source")
I get this result:
Installing package into ‘C:/Users/jk/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
* installing source package 'mvpart' ...
** package 'mvpart' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: running command 'make -f "C:/PROGRA~1/R/R-31~1.3/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-31~1.3/share/make/winshlib.mk" SHLIB="mvpart.dll" OBJECTS="anova.o branch.o bsplit.o choose_surg.o dist.o fix_cp.o formatg.o free_tree.o gini.o graycode.o insert_split.o make_cp_list.o make_cp_table.o mrt.o mysort.o nodesplit.o partition.o poisson.o pred_rpart.o rpart.o rpart_callback.o rpartexp2.o rpcountup.o rpmatrix.o rundown.o rundown2.o s_to_rp.o s_xpred.o surrogate.o usersplit.o vgdist.o xdiss.o xval.o"' had status 127
ERROR: compilation failed for package 'mvpart'
* removing 'C:/Users/jk/Documents/R/win-library/3.1/mvpart'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l "C:\Users\jk\Documents\R\win-library\3.1" "D:/mvpart_1.6-2.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘D:/mvpart_1.6-2.tar.gz’ had non-zero exit status
My questions are: Did I do something wrong here - is there a way to install 'mvpart'? Or, is there another package that will do multivariate partitioning, similar to 'mvpart'?
Option 1:
An archive install must be compiled, as it's stored as source code. Probably, you have not installed the R Tools compiler for Windows. Follow the install instructions here.
Once that was done, for me, mvpart installed flawlessly from the downloaded archive:
install.packages("C:/mydownload/path/mvpart_1.6-2.tar.gz", repos = NULL, type = "source")
Option 2:
If Option 1 doesn't get the job done, get the devtools package:
install.packages("devtools")
Use it to get the github version:
devtools::install_github("cran/mvpart")
I believe you'll still need the R tools compiler though
downloading Xcode from either the Apple AppStore or Apple Developer website solved my issues installing mvpart. The app version required iOS 10.13 as of this post, but it was easy to find a compatible older version on the website to download. After you download it, move it to your Applications folder and then open it. After that then the devtools:::install_github() worked for me.
I don't remember having any problems with this, but seemingly suddenly, I can't install any packages because testthat is not there to pass tests. As a catch-22, I can't install testthat either, because it's not there to pass its tests.
R version 3.0.1 (2013-05-16) -- "Good Sport"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
Error in library(testthat) : there is no package called 'testthat'
[Previously saved workspace restored]
>
> install.packages("testthat")
Installing package into '/home/user/R/x86_64-pc-linux-gnu-library/3.0'
(as 'lib' is unspecified)
--- Please select a CRAN mirror for use in this session ---
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
trying URL 'http://cran.cs.wwu.edu/src/contrib/testthat_0.8.1.tar.gz'
Content type 'application/x-gzip' length 40777 bytes (39 Kb)
opened URL
==================================================
downloaded 39 Kb
Error in library(testthat) : there is no package called 'testthat'
Calls: source -> withVisible -> eval -> eval -> library
Execution halted
The downloaded source packages are in
'/tmp/RtmpMoaIPO/downloaded_packages'
Warning message:
In install.packages("testthat") :
installation of package 'testthat' had non-zero exit status
Is there a way to bypass testing for one install run or otherwise work around this so I can fix my R install?
I live somewhere with poor internet, and I didn't want to download a new version of R and all its dependencies to fix this problem. So you can install an old version of testthat manually:
http://cran.r-project.org/src/contrib/Archive/testthat/
On version 3.0.2, testthat version 0.8.1 seems to work. Once you have downloaded the gzip file, do:
R CMD INSTALL testthat_0.8.1.tar.gz
If you are using linux, you don't have to manually download the package, installing the dependency( in this case 'testthat') via your default manager will also work. I have ubuntu 14.04 and R 3.0.2
sudo apt-get install r-cran-testthat
After running the above command I was able to finally install swirl.
For the record, a full update fixed this, but I don't know why.