R install_github produces error: command failed (5) - r

I am trying to install the package rpivottable via install_github.
When trying I get the error:
Downloading github repo smartinsightsfromdata/rpivotTable#master
Installing rpivotTable
"C:/R/R-PORT~1/App/R-PORT~1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore CMD INSTALL \
"C:/Users/..../AppData/Local/Temp/RStudioPortableTemp/RtmpyAFPYw/devtools1df857205157/smartinsightsfromdata-rpivotTable-4c7d219" \
--library="C:/R/R-Portable/App/R-Portable/library" --install-tests
Error: Command failed (5)
Rtools is properly installed, find_rtools returns TRUE.
I am running R on the Rportable version due to limitations on admin policies on the machine. In particular I had to set the PATH from R as I don't have access from Windows, but after installing and reinstalling the PATH contains the two paths to Rtools and gcc bins.
The information on my sessionInfo is here:
R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_0.11.1 devtools_1.8.0
loaded via a namespace (and not attached):
[1] bitops_1.0-6 digest_0.6.8 git2r_0.10.1 htmltools_0.2.6 httpuv_1.3.2 httr_0.6.1 memoise_0.2.1 mime_0.3 R6_2.0.1
[10] Rcpp_0.11.6 RCurl_1.95-4.6 RJSONIO_1.3-0 rversions_1.0.0 stringr_0.6.2 tools_3.1.3 XML_3.98-1.1 xtable_1.7-4
I don't think the problem is related to the package specifically since before I had the same problem with htmlwidgets if try to install via install_github, and I managed to install it directly from CRAN to solve the problem.
I have checked the code of install_github but I can't find what generates the command failed(5) error message. I have got lost after going down a few levels in the call stack.
Any help would be appreciated.

Related

R package not available in batch mode

I have been running a bash script (under Ubuntu) that calls and runs some R scripts to plot some maps with ggplot2. As it is a production system I don't update any new R or package releases. But recently I tried to install plotly with an error message output.
Now, when trying to run the script (calling a php webpage trhough a browser; that was running fine for a lot of time) an error with crayon package halts and exits the script without plotting the maps.
'/usr/lib/R/bin/R --slave --no-restore --no-save --no-restore --file=./RAMS-mapa-onades-zones-manual.R'
Loading required package: sp
Loading required package: methods
Checking rgeos availability: TRUE
Error : .onLoad failed in loadNamespace() for 'pillar', details:
call: loadNamespace(name)
error: there is no package called 'crayon'
Error: package or namespace load failed for 'ggplot2'
Execution halted
But if I run from a terminal or with RStudio server crayon package is loaded, ggplot2 is also properly loaded, and the maps are produced.
crayon package (located at /home/meteo/R/i686-pc-linux-gnu-library/3.1) called as
library("crayon", lib.loc= c("/home/meteo/R/i686-pc-linux-gnu-library/3.1", "/usr/local/lib/R/site-library", "/usr/lib/R/library"))
R session info on Rstudio Server:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: i686-pc-linux-gnu (32-bit)
Running under: Ubuntu precise (12.04.5 LTS)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] crayon_1.3.4 rgdal_0.9-1 rgeos_0.3-8 raster_2.3-24 gpclib_1.5-5 mapproj_1.2-2 maps_2.3-9
[8] stringr_0.6.2 plyr_1.8.1 ggplot2_3.2.0 maptools_0.8-34 sp_1.2-3
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 magrittr_1.5 tidyselect_0.2.5 munsell_0.5.0 colorspace_1.2-4 lattice_0.20-33 R6_2.4.0
[8] rlang_0.3.4 dplyr_0.8.1 tools_3.2.2 gtable_0.1.2 withr_2.1.2 digest_0.6.8 lazyeval_0.2.2
[15] assertthat_0.2.1 tibble_2.1.3 purrr_0.3.2 glue_1.3.1 labeling_0.3 pillar_1.4.1 scales_1.0.0
[22] foreign_0.8-66 pkgconfig_2.0.2
Maybe there is a version conflict? How do I check?
what version of R is in /usr/lib/R/bin/R? Basically it appears you are in a slight "dependency hell" I would run /usr/lib/R/bin/R and check to see if crayon is installed there. #Alexis is correct though, it is not wise to mix versions like that. Let R handle library location unless you are trying to separate packages. Check the libraries for 3.2.2 and see if crayon is installed. you may have switched your R version since plotly depends on R >=3.2.0 https://cran.r-project.org/web/packages/plotly/
I think the easy fix would be to correct your .libpaths() i.e not call the 3.1 library and install the correct version of the packages you need.
OR
switch from R 3.2 back to R 3.1

Cannot load package in R

Since yesterday, I cannot load some common used packages, e.g. reshape2 and stringr through library command.
Step to reproduce my problem:
1) Start a new session in Rstudio server (Version 0.99.467). I also kill the active-sessions in Rstudio server.
2) Run these codes
library(ggplot2)
library(stringr)
3) Get an error message:
Error in unloadNamespace(package) :
namespace ‘stringr’ is imported by ‘reshape2’ so cannot be unloaded
Show Traceback
Rerun with Debug
Error in library(stringr) : “stringr” version 0.6.2 cannot be unloaded.
But I don't get error if stringr is loaded before ggplot2. How should I fix this problem. Thanks for any suggestions.
I may have to update R to 3.2
My R session info:
R version 3.1.3 (2015-03-09)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
[5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8 LC_PAPER=en_AU.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_1.0.0
loaded via a namespace (and not attached):
[1] colorspace_1.2-4 digest_0.6.4 grid_3.1.3 gtable_0.1.2 MASS_7.3-39 munsell_0.4.2 plyr_1.8.1
[8] proto_0.3-10 Rcpp_0.11.2 reshape2_1.4 scales_0.2.4 stringr_0.6.2 tools_3.1.3
I resolved my problem through updating R and all R packages.
I guess the problem is caused by old version of stringr or reshape2 as I install the same packages in different places (system folder or personal library). R tried to load a old version of package.
Even though it is a good practice to update R for me it was not necessary to solve the same issue. The problem can result from few .libPaths(). With .libPaths("C:/Program Files/R/R-3.4.3patched/library") you can point out one folder. After that just reinstall of packages, and it should work.
My code:
> .libPaths()
[1] "L:/My Documents/R/win-library/3.4" "C:/Program Files/R/R-3.4.3patched/library"
> .libPaths("C:/Program Files/R/R-3.4.3patched/library")
> packages<-c('ggplot2','data.table','knitr','xtable')
> install.packages(packages)
> lapply(packages,library,character.only=T)
Even though the issue is solved I hope it will help someone.

Enable travis CI to check for package dependencies

Actual question
What do I need to do in order to enable travis CI to check my package dependencies?
What I tried
I tried adding the cran argument to .travis.yml file as describe in guide on travis-ci.com.
My .travis.yml file looks like this:
language: r
warnings_are_errors: yes
sudo: required
cran: http://cran.rstudio.com
r_packages:
- covr
after_success:
- Rscript -e 'covr::codecov()'
Yet, I still get the following error:
* checking package dependencies ... ERROR
No repository set, so cyclic dependency check skipped
Session info
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devops_0.1.2
loaded via a namespace (and not attached):
[1] magrittr_1.5 tools_3.2.2 yaml_2.1.13 memoise_0.2.1 stringi_1.0-1
[6] stringr_1.0.0 digest_0.6.8 devtools_1.9.1
Update
I found out that the error was actually cause by listing some package dependencies in Suggests: instead of Imports: section of my DESCRIPTION file (build that passed).
However, I'm still getting a note that the dependency check was skipped as no repository has been set:
* checking package dependencies ... NOTE
No repository set, so cyclic dependency check skipped
Does that mean that a dependency check has not been carried out and, if so, what do I need to change in order to make this happen?

Installation error "no package specified" - trying to install slidify from github in windows

When I tried git-hub install, using:
install_github('slidify', 'ramnathv')
But I got the follwing message:
> install_github('slidify', 'ramnathv')
Installing github repo slidify/master from ramnathv
Downloading master.zip from https://github.com/ramnathv/slidify/archive/master.zip
Installing package from C:\Users\6E86~1\AppData\Local\Temp\RtmpYD4xRM/master.zip
Installing slidify
"C:/PROGRA~1/R/R-31~1.0/bin/i386/R" --vanilla CMD INSTALL "C:\Users\ \
ע\AppData\Local\Temp\RtmpYD4xRM\devtools1f901f6d4e5e\slidify-master" \
--library="C:/Program Files/R/R-3.1.0/library" --install-tests
Warning: invalid package 'C:\Users\ע\AppData\Local\Temp\RtmpYD4xRM\devtools1f901f6d4e5e\slidify-master'
Error: ERROR: no packages specified
Error: Command failed (1)
I also tried downlowding "slidify-master.zip" and installing it localy using:
install.packages("c:/r/packages/slidify-master.zip", repos = NULL, type="source")
but nothing seems to happen, and the package is not installed:
> library(slidify)
Error in library(slidify) : there is no package called ‘slidify’
my sessionInfo() is:
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=Hebrew_Israel.1255 LC_CTYPE=Hebrew_Israel.1255
[3] LC_MONETARY=Hebrew_Israel.1255 LC_NUMERIC=C
[5] LC_TIME=Hebrew_Israel.1255
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_1.5
loaded via a namespace (and not attached):
[1] digest_0.6.4 evaluate_0.5.5 httr_0.3 memoise_0.2.1 parallel_3.1.0
[6] RCurl_1.95-4.1 stringr_0.6.2 tools_3.1.0 whisker_0.3-2
any ideas?
The problem presisted when I tried to install other packages from Github.
Seems it has to do ith the user name, and the directory where the downloads are stored.
I created a new user in windows with a simple name (no spaces, no special characters) and the installation succeeded !

R Rmetrics packages

I ´ve tried to install some packages from Rmetrics, but it looks I am doing something wrong.
For
https://r-forge.r-project.org/scm/viewvc.php/pkg/fPortfolioBacktest/?logsort=cvs&root=rmetrics&pathrev=4948
I simply used
install.packages("fPortfolioBacktest", repos="http://R-Forge.R-project.org")
but
> install.packages("fPortfolioBacktest", repos="http://R-Forge.R-project.org")
Warning: unable to access index for repository http://R-Forge.R-project.org/bin/windows/contrib/2.12
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘fPortfolioBacktest’ is not available
Exactly the same problem is with
https://r-forge.r-project.org/scm/viewvc.php/pkg/Rsocp/?root=rmetrics&pathrev=3690
> sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=Slovak_Slovakia.1250 LC_CTYPE=Slovak_Slovakia.1250 LC_MONETARY=Slovak_Slovakia.1250 LC_NUMERIC=C
[5] LC_TIME=Slovak_Slovakia.1250
attached base packages:
[1] splines stats graphics grDevices utils datasets methods base
other attached packages:
[1] corpcor_1.5.7 fPortfolio_2130.80 fAssets_2100.78 fCopulae_2110.78 sn_0.4-16
[6] mnormt_1.4-3 robustbase_0.7-0 xlsx_0.3.0 xlsxjars_0.3.0 rJava_0.8-8
[11] ttrTests_1.5 PerformanceAnalytics_1.0.3.2 fTrading_2110.77 fBasics_2110.80 timeSeries_2130.90
[16] timeDate_2130.91 dynlm_0.3-0 car_2.0-8 survival_2.36-3 nnet_7.3-1
[21] MASS_7.3-8 lmtest_0.9-27 tseries_0.10-24 quadprog_1.5-3 quantmod_0.3-15
[26] TTR_0.20-2 xts_0.8-0 zoo_1.6-4 Defaults_1.1-1
loaded via a namespace (and not attached):
[1] grid_2.12.0 lattice_0.19-13 Rglpk_0.3-5 slam_0.1-22 strucchange_1.4-2 tools_2.12.0
Is there a fast way how to install them with all the dependencies? I am using Windows XP
Thanks,
Alex
Thanks for adding the error and your sessionInfo.
As I said in my comment, you're running an old version of R (2.12.0). R-forge only builds binaries for the most recent major revision (2.13.X). You need to either upgrade R or build from source. To build from source on Windows, you will need the Windows toolset.

Resources