I use the following code to install h2o-3 in R
# The following two commands remove any previously installed H2O packages for R.
if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }
# Next, we download packages that H2O depends on.
pkgs <- c("methods","statmod","stats","graphics","RCurl","jsonlite","tools","utils")
for (pkg in pkgs) {
if (! (pkg %in% rownames(installed.packages()))) { install.packages(pkg) }
}
# Now we download, install and initialize the H2O package for R.
install.packages("h2o", type="source", repos=(c("http://h2o-release.s3.amazonaws.com/h2o/rel-turing/3/R")))
library(h2o)
localH2O = h2o.init(nthreads=-1)
# Finally, let's run a demo to see H2O at work.
demo(h2o.kmeans)
It shows the following error.
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.3.1\library" C:\Users\pintoo\AppData\Local\Temp\RtmpUxsC47/downloaded_packages/h2o_3.10.0.3.tar.gz' had status 65535
Warning in install.packages :
installation of package ‘h2o’ had non-zero exit status
Then, as the above code, doesn't install package, and it shows it has been downloaded so i tried installing using the downloaded package using the below code
install.packages("C:/Users/pintoo/AppData/Local/Temp/RtmpUL3Da2/downloaded_packages/h2o_3.10.0.3.tar.gz",
repos = NULL, type = "source", dependencies = T)
It produced the below error
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.3.1\library" "C:/Users/pintoo/AppData/Local/Temp/RtmpUL3Da2/downloaded_packages/h2o_3.10.0.3.tar.gz"' had status 65535
Warning in install.packages :
installation of package ‘C:/Users/pintoo/AppData/Local/Temp/RtmpUL3Da2/downloaded_packages/h2o_3.10.0.3.tar.gz’ had non-zero exit status
MY version :
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 3.1
year 2016
month 06
day 21
svn rev 70800
language R
version.string R version 3.3.1 (2016-06-21)
nickname Bug in Your Hair
Can any one help me out.
What is this non-zero exit status.
status 65535 meaning?
Non- zero exit status of package means?
The error message you gave is for the second of your two install lines; you don't say what happened with the first one.
But, my recommended way to install H2O on R:
install.packages("h2o")
Simple! This will get the latest version from CRAN, and automatically find all the dependencies. The downside is you are a version or so behind the latest. But the product is mature (so being a version back is fine) and development is fairly rapid (so being a version back can sometimes even be better)!
Only use the instructions on the H2O site if you have a good reason to need the latest version. (And I still recommend installing the first time from CRAN, as it is harder to get something wrong, so if that doesn't work, maybe H2O is incompatible with your machine or something like that.)
P.S. The 65535 (i.e. -1) error code is probably a Windows one, and from some googling appears to be a generic one meaning something crashed. If you do pursue it, I'd be suspicious about either access permissions to certain directories, or paths with spaces in them. (IIRC, R used to recommend not installing in directories with spaces in them.)
Related
Before you mark this as duplicate, I wish to say that I already referred the related post 1,post 2, 3, 4
I am trying to install the dplyr and stringr package but i get the below error
Warning in install.packages :
downloaded length 139264 != reported length 3227450
Warning in install.packages :
error 1 in extracting from zip file
Warning in install.packages :
cannot open compressed file 'dplyr/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection
I tried different installation commands like
install.packages(“dplyr”)
install.packages(“dplyr”, repos="http://cran.us.r-project.org")
install.packages(“dplyr”, repos="http://cran.us.r-project.org",type="win.binary")
> Sys.info()
sysname release version machine
"Windows" "10 x64" "build 17134" "x86-64"
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 6.2
year 2019
month 12
day 12
svn rev 77560
language R
version.string R version 3.6.2 (2019-12-12)
nickname Dark and Stormy Night
Till yesterday, I was able to install this package successfully. But today it is throwing this error.
This error happens with other packages like stringr as well. I tried chaging CRAN mirrors as well but still no help
Can help please?
I have downloaded a R package and installed from local files. Next I tried to install a package, with many imports, through Install package(s), I could not install. I closed R and restarted R, now I am able to install packages, with many imports. Rahul, R user.
This error typically happens because R cannot access the default directory for installing the packages. This error is a system-related error. Try this solution. It worked out for me. I changed the default installation directory in the environment variables and it worked smoothly.
I have download this package as a zip file.
Is it possible to install it from R console using this zip or unzip version to a specific path?
install.packages("C:/Users/Desktop/rvest-master.zip', lib='C:/R/R-3.2.1',repos = NULL)
I type the previous command but is not working
> setwd("C:/Users/Desktop/")
> unzip("rvest-master.zip")
> file.rename("rvest-master", "rvest")
[1] TRUE
> shell("R CMD build rvest")
Warning messages:
1: running command ' /c R CMD build rvest' had status 127
2: In shell("R CMD build rvest") :
'R CMD build rvest' execution failed with error code 127
> install.packages("rvest_0.2.0.9000.tar.gz", repos = NULL)
Installing package into ‘C:/Users/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning: invalid package 'rvest_0.2.0.9000.tar.gz'
Error: ERROR: no packages specified
Warning messages:
1: running command '"C:/R/R-3.2.1/bin/x64/R" CMD INSTALL -l "C:\Users\Documents\R\win-library\3.2" "rvest_0.2.0.9000.tar.gz"' had status 1
2: In install.packages("rvest_0.2.0.9000.tar.gz", repos = NULL) :
installation of package ‘rvest_0.2.0.9000.tar.gz’ had non-zero exit status
In the previous line are the results from the answer
You have downloaded a zip of the source of a package. This is not the standard packaging of a package source nor is it a standard Windows binary (i.e., a built package distributed as a .zip, as from CRAN).
The easiest thing for you to do is to install this package directly from Github using devtools:
library("devtools")
install_github("hadley/rvest")
If you decide to install it locally, you need to unzip the package directory, build it from the command line using R CMD build rvest and then install either using R CMD INSTALL or from within R using the command you already have (but performed on the built "tarball"). Here's how you could do all of this from within R:
setwd("C:/Users/Desktop/")
unzip("rvest-master.zip")
file.rename("rvest-master", "rvest")
shell("R CMD build rvest")
This will make a tarball version of the package in the current directory. You can then install that with
install.packages("rvest_0.2.0.9000.tar.gz", repos = NULL)
Since the version number is merged into the tarball name, it may not always be obvious what the new file might be called. You can use list.files() to grab the new tarball.
install.packages(list.files(pattern="rvest*.tar.gz"), repos = NULL)
If the shell() line gives you an error like this
'R' is not recognized as an internal or external command
You need to make sure that R is in your shell path. You can add it with something like
Sys.setenv(PATH=paste(R.home("bin"), Sys.getenv("PATH"), sep=";"))
Try install.packages('C:/Users/Desktop/rvest-master.zip', repos = NULL, type = "win.binary"). (Untested)
Hard to believe this don't have a clear, simple and accurate answer.
The zip you downloaded from github by clicking "download as zip" is a pack of that repo, which is not the standard R source package format like CRAN hosted. Thus the methods that work with CRAN source tar.gz will not work with this kind of zip.
The simplest method is to use devtools::install_local. If devtools bring too many dependencies to you, you can use remotes::install_local which is the real function and have much less dependencies.
If this is the zip of the source of a package, and the R core install.packages() doesn't work, then you can use install_local() from the devtools package.
I often do this when installing packages from GitHub as getting curl through our proxy is painful. So I download the source zip and install like this.
On Windows 7 and R 3.5.3 I had to extract the zip, repackage it as .tar.gz and then install it using the command below. When installing the zip the package will not be indexed by R.
install.packages("C:/your-package.tar.gz", repos = NULL, type = "win.binary", lib="C:/Users/username/Documents/R/R-3.5.3/library")
Environment
version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 5.3
year 2019
month 03
day 11
svn rev 76217
language R
version.string R version 3.5.3 (2019-03-11)
nickname Great Truth
You can make use of install_local method in devtools package. Unzip the zipped file and specify the folder which contains DESCRIPTION file of the package in the path argument or you can also make use of subdir argument.
If it doesn't explains, I will post an example... Let me know.
Download the package.tar.gz
Then from command line :
R CMD INSTALL package.tar.gz
I have been trying to install packages from MRAN, specifically bsts amoung others. If I run:
install.packages(c("Boom","BoomSpikeSlab", "bsts"),repos = "https://mran.revolutionanalytics.com/snapshot/2016-01-01/")
I get the following output:
Warning in install.packages :
URL 'https://mran.revolutionanalytics.com/snapshot/2016-01-01/bin/macosx/mavericks/contrib/3.3/PACKAGES.gz': status was '404 Not Found'
Warning in install.packages :
URL 'https://mran.revolutionanalytics.com/snapshot/2016-01-01/bin/macosx/mavericks/contrib/3.3/PACKAGES': status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://mran.revolutionanalytics.com/snapshot/2016-01-01/bin/macosx/mavericks/contrib/3.3:
cannot download all files
Packages which are only available in source form, and may need compilation of C/C++/Fortran: ‘Boom’ ‘BoomSpikeSlab’ ‘bsts’
Do you want to attempt to install these from sources?
y/n:
I also get the same result when changing the repository location using options(). A simple solution would be simply to install from source as below:
install.packages(c("Boom","BoomSpikeSlab", "bsts"),repos = "https://mran.revolutionanalytics.com/snapshot/2016-01-01/",type = "source")
However what doesn't make sense is that, when you check the repository on your browser, the binaries appear to be available:
https://cran.r-project.org/web/packages/bsts/index.html (CRAN)
https://mran.revolutionanalytics.com/snapshot/2016-01-01/web/packages/bsts/index.html (MRAN)
Additionally I would prefer not to have to compile the source code, especially as R's compiler is out of date...
Previous stack overflow questions have suggested this is because the repository is down, however this doesn't make sense as the binaries can be accessed through the browser. So is there an issue with MRAN, is there an issue with install.packages?
I should note I have tried executing this code in both RStudio and R through the terminal. Additionally, for reference, this is my system details:
platform x86_64-apple-darwin13.4.0
arch x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
status
major 3
minor 3.2
year 2016
month 10
day 31
svn rev 71607
language R
version.string R version 3.3.2 (2016-10-31)
nickname Sincere Pumpkin Patch
Thanks in advance for the help.
I've now solved this problem. When calling from the MRAN repository using install.packages you need to capitalise "MRAN" part of the URL.
So this works:
install.packages("bsts", repos = "https://MRAN.revolutionanalytics.com/snapshot/2016-06-01/")
And this only works from source:
install.packages("bsts", repos = "https://mran.revolutionanalytics.com/snapshot/2016-06-01/")
I have download this package as a zip file.
Is it possible to install it from R console using this zip or unzip version to a specific path?
install.packages("C:/Users/Desktop/rvest-master.zip', lib='C:/R/R-3.2.1',repos = NULL)
I type the previous command but is not working
> setwd("C:/Users/Desktop/")
> unzip("rvest-master.zip")
> file.rename("rvest-master", "rvest")
[1] TRUE
> shell("R CMD build rvest")
Warning messages:
1: running command ' /c R CMD build rvest' had status 127
2: In shell("R CMD build rvest") :
'R CMD build rvest' execution failed with error code 127
> install.packages("rvest_0.2.0.9000.tar.gz", repos = NULL)
Installing package into ‘C:/Users/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning: invalid package 'rvest_0.2.0.9000.tar.gz'
Error: ERROR: no packages specified
Warning messages:
1: running command '"C:/R/R-3.2.1/bin/x64/R" CMD INSTALL -l "C:\Users\Documents\R\win-library\3.2" "rvest_0.2.0.9000.tar.gz"' had status 1
2: In install.packages("rvest_0.2.0.9000.tar.gz", repos = NULL) :
installation of package ‘rvest_0.2.0.9000.tar.gz’ had non-zero exit status
In the previous line are the results from the answer
You have downloaded a zip of the source of a package. This is not the standard packaging of a package source nor is it a standard Windows binary (i.e., a built package distributed as a .zip, as from CRAN).
The easiest thing for you to do is to install this package directly from Github using devtools:
library("devtools")
install_github("hadley/rvest")
If you decide to install it locally, you need to unzip the package directory, build it from the command line using R CMD build rvest and then install either using R CMD INSTALL or from within R using the command you already have (but performed on the built "tarball"). Here's how you could do all of this from within R:
setwd("C:/Users/Desktop/")
unzip("rvest-master.zip")
file.rename("rvest-master", "rvest")
shell("R CMD build rvest")
This will make a tarball version of the package in the current directory. You can then install that with
install.packages("rvest_0.2.0.9000.tar.gz", repos = NULL)
Since the version number is merged into the tarball name, it may not always be obvious what the new file might be called. You can use list.files() to grab the new tarball.
install.packages(list.files(pattern="rvest*.tar.gz"), repos = NULL)
If the shell() line gives you an error like this
'R' is not recognized as an internal or external command
You need to make sure that R is in your shell path. You can add it with something like
Sys.setenv(PATH=paste(R.home("bin"), Sys.getenv("PATH"), sep=";"))
Try install.packages('C:/Users/Desktop/rvest-master.zip', repos = NULL, type = "win.binary"). (Untested)
Hard to believe this don't have a clear, simple and accurate answer.
The zip you downloaded from github by clicking "download as zip" is a pack of that repo, which is not the standard R source package format like CRAN hosted. Thus the methods that work with CRAN source tar.gz will not work with this kind of zip.
The simplest method is to use devtools::install_local. If devtools bring too many dependencies to you, you can use remotes::install_local which is the real function and have much less dependencies.
If this is the zip of the source of a package, and the R core install.packages() doesn't work, then you can use install_local() from the devtools package.
I often do this when installing packages from GitHub as getting curl through our proxy is painful. So I download the source zip and install like this.
On Windows 7 and R 3.5.3 I had to extract the zip, repackage it as .tar.gz and then install it using the command below. When installing the zip the package will not be indexed by R.
install.packages("C:/your-package.tar.gz", repos = NULL, type = "win.binary", lib="C:/Users/username/Documents/R/R-3.5.3/library")
Environment
version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 5.3
year 2019
month 03
day 11
svn rev 76217
language R
version.string R version 3.5.3 (2019-03-11)
nickname Great Truth
You can make use of install_local method in devtools package. Unzip the zipped file and specify the folder which contains DESCRIPTION file of the package in the path argument or you can also make use of subdir argument.
If it doesn't explains, I will post an example... Let me know.
Download the package.tar.gz
Then from command line :
R CMD INSTALL package.tar.gz
EDIT :
Many thanks to user20650, whose answer solved this problem. But if anyone knows why the .Rprofile file affects lme4 install on Ubuntu 12.04, please advise because I'd really like to know.
Original post :
I'm attempting to install the doBy package and am having some issues. It depends on lme4, which for some reason is not compiling from any source I've tried so far. I've been to a few links on SO including this one and haven't had any success.
Here are snippets of the errors I'm getting on install. I tried it three different ways, as noted below. Anyone know if something's up with lme4?
Attempt 1:
> install.packages('doBy')
# ...
# ERROR: compilation failed for package ‘lme4’
# * removing ‘/home/richard/R/x86_64-pc-linux-gnu-library/3.1/lme4’
# Warning in install.packages :
# installation of package ‘lme4’ had non-zero exit status
#
# Successfully loaded .Rprofile at Wed May 21 13:33:34 2014
# ERROR: dependency ‘lme4’ is not available for package ‘doBy’
# * removing ‘/home/richard/R/x86_64-pc-linux-gnu-library/3.1/doBy’
# Warning in install.packages :
# installation of package ‘doBy’ had non-zero exit status
Attempt 2:
> install.packages("lme4",repos = "http://r-forge.r-project.org")
# Installing package into ‘/home/richard/R/x86_64-pc-linux-gnu-library/3.1’
# (as ‘lib’ is unspecified)
# Warning in install.packages :
# package ‘lme4’ is not available (for R version 3.1.0)
Attempt 3:
> install_github(repo = 'lme4/lme4', username = 'stevencarlislewalker')
Running Ubuntu 12.04 LTS
> version
# _
# platform x86_64-pc-linux-gnu
# arch x86_64
# os linux-gnu
# system x86_64, linux-gnu
# status
# major 3
# minor 1.0
# year 2014
# month 04
# day 10
# svn rev 65387
# language R
# version.string R version 3.1.0 (2014-04-10)
# nickname Spring Dance
This (possibly) may not be an answer to Richard's Q. but does replicate a problem i had installing lme4 on ubuntu 12,04 on Rv3.1. It would be good if others could reproduce this.
So following on from my comment - noticing that Richard had a .Rprofile, defining .First and .Last in my .Rprofile caused packages not to install.
Exmaple
First uninstall lme4
remove.packages("lme4")
Define .Rprofile file
## .First() run at the start of every R session.
.First <- function() {
cat("\nSuccessfully loaded your .Rprofile at", date(), "\n")
}
## .Last() run at the end of the session
.Last <- function() {
cat("\nGoodbye at ", date(), "\n")
}
Open R
Try an install lme4 - no success & similar error to Richard's above
install.packages("lme4")
...
* removing ‘/home/admin1/R/i686-pc-linux-gnu-library/3.1/lme4’
Warning in install.packages :
installation of package ‘lme4’ had non-zero exit status
So rename (or remove) .Rprofile file in terminal
mv .Rprofile temp.Rprofile
Open R again and try to install lme4
install.packages("lme4")
...
* installing vignettes
** testing if installed package can be loaded
* DONE (lme4)
library(lme4)
# Loading required package: Matrix
# Loading required package: Rcpp
This was a bug, should be fixed by this commit in the development version (on Github) and in release 1.1-7 when it comes out (soon?)
Based on your comments and expanded questions:
You are shooting yourself in the foot by installing R 3.1.0 onto Ubuntu 12.04.
You now run an R that is out of sync with packages like r-cran-lme4 in the distro.
The good news is that you can ask the distribution for information about the so-called Build-Depends it knows, and rebuild lme4 under R 3.1.0
Or can benefit from Michael's other work over at launchpad and use his other repo which is what eg the r-travis code does: sudo add-apt-repository -y "ppa:marutter/rrutter" followed by and sudo add-apt-repository -y "ppa:marutter/c2d4u"
That last step will give you loads of pre-built packages. In the long run you are of course better off being to able to build packages from source yourself...
sudo apt-get install r-base-dev
solved the problem for me