Error installing 'ReporteRs' and 'ReporteRsjars' - r

Ultimately I am attempting to install the R package ReporteRs (ReporteRs_0.8.7.tar.gz) on a Windows 7 system (session info, and other info below). This depends on the package ReporteRsjars (ReporteRsjars_0.0.2.tar.gz) which is where I am getting the install error.
This also depends on the R package rJava which is installed, along with JDK/JRE (jre1.8.0_112).
I am installing on a machine that has no internet access so I am doing this from a local version of CRAN with the PACKAGES and PACKAGES.gz built. This has been working without any issues (at least now it is).
rJava loads without any issues but when installing ReporteRsjars, I get the error below (see Install Attempt ERROR below).
NOTE: Other StackOverflow questions seem more focussed around library(rJava) having issues, not when installing a package dependent on rJava.
The rJava DLL is in the following location:
C:/Program Files/R/R-3.3.2/library/rJava/libs/x64/rJava.dll
This was reinstalled a number of times (successfully).
The sessionInfo and a more information is below the error (including what I tried).
Install Attempt ERROR
cran_dir_url is set to the path where the CRAN packages are located. This is prefixed with file://
> library(rJava)
> install.packages('ReporteRsjars', contriburl=cran_dir_url, repos = cran_dir_url, type = 'source')
## * installing *source* package 'ReporteRsjars' ...
## ** package 'ReporteRsjars' successfully unpacked and MD5 sums checked
## ** R
## ** inst
## ** preparing package for lazy loading
## ** help
## No man pages found in package 'ReporteRsjars'
## *** installing help indices
## ** building package indices
## ** testing if installed package can be loaded
## *** arch - i386
## Error : .onLoad failed in loadNamespace() for 'rJava', details:
## call: library.dynam("rJava", pkgname, libname)
## error: DLL 'rJava' not found: maybe not installed for this architecture?
## Error: loading failed
## Execution halted
## *** arch - x64
## ERROR: loading failed for 'i386'
## * removing 'C:/Program Files/R/R-3.3.2/library/ReporteRsjars'
## Warning in install.packages :
## running command '"C:/PROGRA~1/R/R-33~1.2/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.3.2\library" /Users/cirina_ext/Documents/StevenBanville/CRAN_Targeted/ReporteRsjars_0.0.2.tar.gz' had status 1
## Warning in install.packages :
## installation of package 'ReporteRsjars' had non-zero exit status
##
Environment Information & Tools
Path Info: The following is included in the system path and is where Java was installed.
C:\Program Files\Java\jre1.8.0_112\bin\;C:\Program Files\Java\jre1.8.0_112\bin\server\;%path%
(JDK Installer: jdk-8u112-windows-x64)
Rtools Version and Location
Version: 3.4.0.1962
Location: C:\Rtools
What I Tried
I started with attempting to install the ReporteRs R packages, and this installed all dependencies but failed on the ReporteRsjars package.
After installing the JDK/JRE, I reinstalled rJava (this was done a few times after various attempts to install the R package). All rJava installs were successful, and so was library(rJava).
I attempted to run the following command in a windows command window, as I have seen this recommended in a number of SO answers.
R CMD javareconf
'javareconf' is not recognized as an internal or external command, operable program or batch file.
I attempted to include the path to the rJava DLL in the path system variable but that did not work.
NOTE: I restarted the RGui and RStudio after each of these attempts (I tried in both of these environments). I also rebooted the machine.
I have done a lot of googling and looking at StackOverflow but all of the issues have found are not the same as this. They appear similar but after attempting a number of things, I still get the above error. I have omitted the links I looked at but can add them if that would help.
An guidance to help me troubleshoot and solve this would be appreciated.
Session Info
> sessionInfo('rJava')
## R version 3.3.2 (2016-10-31)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 7 x64 (build 7601) Service Pack 1
##
## locale:
## [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
## [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
## [5] LC_TIME=English_United States.1252
##
## attached base packages:
## character(0)
##
## other attached packages:
## [1] rJava_0.9-8
##
## loaded via a namespace (and not attached):
## [1] graphics_3.3.2 tools_3.3.2 utils_3.3.2 grDevices_3.3.2 stats_3.3.2 datasets_3.3.2
## [7] methods_3.3.2 base_3.3.2
EDIT
I attempted the same install on a different machine with only the 64 bit version of Java (and confirmed it is 64 bit) and got the same error. Here is a snippet but it is the same as the above error:
...
*** arch - i386
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: library.dynam("rJava", pkgname, libname)
error: DLL 'rJava' not found: maybe not installed for this architecture?
Error: loading failed
Execution halted
...
I am still looking at the link from the comment by #42-, but this doesn't look like an issue with the JRE/JDK not being 64 bit.
EDIT 2
Note: this is not posted as an answer since it is just a workaround.
I found a workaround which is not quite desirable. It seems the install from the local CRAN copy was not quite as similar as I had expected. I installed the problematic library install(s) on an equivalent Windows 7 machine using a NON-local CRAN (i.e. the usual way) and copied the directories to the other machine (i.e. the machine not connected to the internet). This appears to have worked but it is not clear why the other method did not (local CRAN copy with updated PACKAGES file). The one thing I noticed is, when hitting the usual CRAN repository, it used .zip versions of the libraries and not the tar.gz; I am not sure if that matters.
EDIT 3
Based on the response from David Gohel in the this ReporteRs Issues, the following code with the INSTALL_opts = "--no-multiarch" added may fix the issue:
install.packages("ReporteRs", contriburl=cran_dir_url,
repos = cran_dir_url,
type = 'source', INSTALL_opts = "--no-multiarch")
I will add this as an answer if I determine that it would fix the issue, however, I have already implemented the workaround mentioned in EDIT 2.

Based on the response from David Gohel in this GitHub ReporteRs Issues, the following code with the INSTALL_opts = "--no-multiarch" added, fixed the issue I was having:
install.packages("ReporteRs", contriburl=cran_dir_url,
repos = cran_dir_url,
type = 'source',
INSTALL_opts = "--no-multiarch")
Edit
The variable cran_dir_url should point to a directory that contains the .tar.gz install package files. Two examples of paths that could be used are the following:
# (*) Web: URL pointing to CRAN
cran_dir_url <- "https://cloud.r-project.org/src/contrib"
# (*) Local: Pointing to local copy of CRAN (or whatever local packages you
# would like to install).
# Note: this example is a Mac OS path with username "someuser".
# Note: the three "/" chars are correct ("file://" followed by "/Users/..." => "file:///Users/..."
cran_dir_url <- "file:///Users/someuser/CRAN_Local/"
Inside of the above two paths (http and file), there will be .tar.gz files (e.g. ggplot2_3.3.5.tar.gz).

Related

Failure to install package from github using devtools

I am unable to install a package from GitHub. SCCRWP/ASCI. This is a model for assessing stream health using algal community composition. First my session info:
- Session info ------------------------------------------------------------------------------
setting value
version R version 4.1.3 (2022-03-10)
os Windows 10 x64 (build 19044)
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz America/Los_Angeles
date 2022-06-28
rstudio 2022.02.3+492 Prairie Trillium (desktop)
pandoc NA
I will run the following:
library(devtools)
curl::ie_proxy_info()
install_github('SCCWRP/ASCI')
I have to run curl: whenever I use an API or github due to work's system settings. I get the following error message.
Downloading GitHub repo SCCWRP/ASCI#HEAD
SCCWRP-ASCI-82bd614/mmilkup.RData: truncated gzip input
tar.exe: Error exit delayed from previous errors.
Error: Failed to install 'ASCI' from GitHub:
Does not appear to be an R package (no DESCRIPTION)
In addition: Warning messages:
1: In utils::untar(tarfile, ...) :
‘tar.exe -xf "C:\Users\nmack\AppData\Local\Temp\RtmpOcZ5L9\file53d87e726d5b.tar.gz" -C "C:/Users/nmack/AppData/Local/Temp/RtmpOcZ5L9/remotes53d8228135e9"’ returned error code 1
2: In system(cmd, intern = TRUE) :
running command 'tar.exe -tf "C:\Users\nmack\AppData\Local\Temp\RtmpOcZ5L9\file53d87e726d5b.tar.gz"' had status 1
I contacted the package's author and was advised to download the repo and install locally. I received an error when installing locally stating that a dependency was missing. Upon installing the missing dependency I was successful => open the .Rproj file => hitting 'ctrl+shft+b'. The problem did not lie in the missing dependency since I am still unable to install with install_github('SCCWRP/ASCI'). The same error above returns. The author above(do not know his SOF handle) gave me two links of similar issues.
NOAA/VAST and SOF. From reading the resolution in one case it would seem a reduced DESCRIPTION would be a solution. The author replied, "I reduced the Description line in the DESCRIPTION file in the ASCI package to one line, so it would be interesting to see if you get the same error again", but I am getting the same error.
Not sure if this matters, but I can not seem to install from a .zip either. When I run:
install.packages("C:/Users/nmack/Downloads/ASCI-master.zip", repos = NULL, type = "win.binary")
I get a quick flash, no error message/notice and no package installed.

R Unable to Install Packages From GitHub (System Error 267 #win/processx.c:1040)

TL;DR
Unable to install any package from GitHub, System Error 267
I've newly setup R (v4.1), Rstudio and just installed devtools.
I also additionally installed Rtools40 and added it to my path (global environment)
Rtools seems to work properly as validated with: Sys.which("make") & maketools::rtools_find() (output below)
Problem
I am unable to install any package from GitHub, e.g. rstudio/gt. The error is nearly identical for any GitHub Package, allways stating system error 267
devtools::install_github("rstudio/gt")
Downloading GitHub repo rstudio/gt#HEAD
Error: Failed to install 'gt' from GitHub:
create process 'C:/PROGRA~1/R/R-41~1.0/bin/x64/Rcmd.exe' (system error 267, Der Verzeichnisname ist ungültig.
) #win/processx.c:1040 (processx_exec
Update
As suggested I reinstalled R 4.1.0 to the most simple folde possible C:/R/
The error ist still the same despite now lacking tildes ~
devtools::install_github("rstudio/gt")
Downloading GitHub repo rstudio/gt#HEAD
Error: Failed to install 'gt' from GitHub:
create process 'C:/R/bin/x64/Rcmd.exe' (system error 267, Der Verzeichnisname ist ungültig.
) #win/processx.c:1040 (processx_exec)
Update 2:
Changed the .libPaths to a folder without any special characters
.libPaths( c( "D:/tmp" , .libPaths() ) )
.libPaths()
[1] "D:/tmp" "C:/Users/Björn/Documents/R/win-library/4.1"
[3] "C:/R/library"
Error is still the same
Update 3:
I updated some packages, and checked the version of packageVersion('processx')= 3.5.2
install.packages("testthat")
install.packages("pkgload")
install.packages("devtools")
install.packages("remote")
Content of Sys.getenv
Sys.getenv('Path')
[1] "C:\\rtools40\\usr\\bin;C:\\R\\bin\\x64;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\bin;
Diagnostics
Session Info
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Rtools successful installed / setup
Sys.which("make")
make
"C:\\rtools40\\usr\\bin\\make.exe"
maketools::rtools_find()
$version
[1] ‘4.0’
$compiler
[1] "gcc 8.3.0"
$api
[1] ‘8’
$PATH
[1] "C:\\rtools40\\usr\\bin"
$BINPREF
[1] "C:/rtools40/mingw$(WIN)/bin/"
$available
[1] TRUE
$compatible
[1] TRUE
The standalone mode of the remotes package solved the issue for me,
as suggested by the maintainer of processx (Gábor Csárdi) here
devtools::install_github() only calls remotes::install_github().
However, for the remotes, there is the option to be exectued in standalone mode
Source: Cran
Standalone mode
remotes will use the curl, git2r and pkgbuild packages if they are
installed to provide faster implementations for some aspects of the
install process. However if you are using remotes to install or update
these packages (or their reverse dependencies) using them during
installation may fail (particularly on Windows).
If you set the environment variable R_REMOTES_STANDALONE="true" (e.g.
in R Sys.setenv(R_REMOTES_STANDALONE="true")) you can force remotes to
operate in standalone mode and use only its internal R
implementations. This will allow successful installation of these
packages
With the following lines of code, gt was finally successfull installed from github.
Sys.setenv(R_REMOTES_STANDALONE="true")
remotes::install_github("rstudio/gt")
Thanks all the commentators for your help!
Update October / 2021
To avoid having to do these steps (Set in standanlone mode, and install with remotes) over and over again everytime you want to install a new package from github another convenient workaround is to just rollback to the previous version of processx as adviced by #rempsy in the github issue:
install.packages("pacman")
pacman::p_del(processx)
# Installing previous verison 3.5.1
install.packages("https://cran.r-project.org/src/contrib/Archive/processx/processx_3.5.1.tar.gz", repos=NULL, type="source")
After the rollback of processx to version 3.5.1, devtools::install_github() works as expected, e.g.
devtools::install_github("rstudio/gt")

"unable to move temporary installation" when installing dependency packages in R

When I install a package, the prerequisite packages were installed first before the actual package. I get the "unable to move temporary installation" warning for all the prerequisite packages, but no such warning for the actual package. But the package will give error when I load it.
For example, when I install.packages("mlr"), it installed all the dependencies and I got various warnings such as this:
package ‘BBmisc’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘D:\Documents\R\win-library\3.2\filef3811142c73\BBmisc’ to ‘D:\Documents\R\win-library\3.2\BBmisc’
I ignored it because it's just a warning. Unfortunately library(mlr) gave me Error: package ‘BBmisc’ required by ‘mlr’ could not be found, so I couldn't ignore it after all.
install.packages("BBmisc") directly didn't produce the warning.
What gives? How can I work through this, short of installing all the dependencies on my own?
In case session info needed:
> 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=English_Singapore.1252 LC_CTYPE=English_Singapore.1252
[3] LC_MONETARY=English_Singapore.1252 LC_NUMERIC=C
[5] LC_TIME=English_Singapore.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.2
This problem is caused by the antivirus (most likely) as was suggested by user3710546. If you cannot disable the antivirus a workaround is to enable debugging in the package unzip function with this command:
debug(utils:::unpackPkgZip)
This will then allow you to step through the code (by pressing enter many times). This just makes the function run slower, giving the antivirus software time to complete its scanning of the new files before R wants to copy them.
I found this solution here.
Following way helped for me for windows 10:
I wanted to install shiny package and was getting same error.
I created "shiny" folder inside /library.
I did setwd to this shiny folder.
Then triggered bellow command: install.packages("shiny",destdir="./",lib="./")
It still failed with the same error, but now zips were downloaded in the shiny folder.
There were two zips: httpuv.zip and shiny.zip
I extracted contents of shiny zip into shiny folder and contents of httpuv zip in httpuv folder.
Restarted R studio to be safe. Then triggered library(shiny) and boom, it worked like a charm..!!!
I tried all the solutions suggested here and elsewhere. I'm running Windows 7 in a large company where antivirus etc. is forced.
The solution for me was:
Uninstall R and RStudio
Delete all files (including hidden) that has to do with R
Install R and RStudio as administrator
Run RStudio as administrator
Only downside is a warning when starting RStudio (running as admin).
All updates and installs works perfect.
If you run the below statement right before the install.packages expression then it should install the package:
trace("unpackPkgZip", where=asNamespace("utils"), quote(Sys.sleep(2.5)), at=14L
,print=FALSE)

How to rebuild the 'indexing' package on MAC OSX

I am trying to install 'indexing' package in r: R-Forge
However, It says it is "failed to build" & am looking for a way to fix this? I do not see a download option for the package.... I am currently on MAC OSX Yosemite and trying to load this in the latest R-Studio.
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
When trying to load via r-studio:
install.packages("indexing", repos="http://R-Forge.R-project.org")
> source repository is unavailable to check versions
> Error in install.packages : Line starting '<!DOCTYPE HTML PUBLI ...' is malformed!
Even though the download link on R-forge doesn't appear to work any more (it may say not available for version >= 3.3. etc), you can still install indexing from source on OSX (or any other operating system).
Open a new terminal in OS X, and in a directly of your choice type the following to install indexing:
svn checkout svn://svn.r-forge.r-project.org/svnroot/indexing/
If you did this correctly, type ls in the terminal and you should see a new directory called indexing. Inside this directory is the source code you need to build the indexing package.
Without changing from the current directory, install the dependency R package mmap if you don't already have it (you might have already installed in from CRAN, in which case you may be able to skip this step) with:
R CMD INSTALL indexing/pkg/mmap
Finally, install indexing from source
R CMD INSTALL indexing/pkg/indexing
You should see something like this in the terminal output if successful:
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library’
* installing *source* package ‘indexing’ ...
** libs
make: Nothing to be done for `all'.
installing to /Library/Frameworks/R.framework/Versions/3.3/Resources/library/indexing/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (indexing)
Enjoy!

package doMC NOT available for R version 3.0.0 warning in install.packages

For some packages like doMC & doSMP, i get the warning & inability to library(doMC).
As shown below, i have no problem with subselect thus no file/directory permission issue.
Also tried repo=http://cran.us.r-project.org & others, no luck.
please advise.
ps: for the unexpected Japanese characters, i have no clue; i assume that is a separable issue; no response yet from support.rstudio.org/help/discussions/problems/6009-japanese-characters-show-unexpectedly
> install.packages('doMC')
Warning in install.packages :
package 租oMC・is not available (for R version 3.0.0)
Installing package into 舛:/Users/YULE/Documents/R/win-library/3.0・(as 鼠ib・is unspecified)
Warning in install.packages :
package 租oMC・is not available (for R version 3.0.0)
> install.packages('subselect')
Installing package into 舛:/Users/YULE/Documents/R/win-library/3.0・(as 鼠ib・is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.0/subselect_0.12-2.zip'
Content type 'application/zip' length 1295653 bytes (1.2 Mb)
opened URL
downloaded 1.2 Mb
package 壮ubselect・successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\YULE\AppData\Local\Temp\Rtmp6DK5mn\downloaded_packages
> library(subselect)
---------------------------------------------------------------------------------
> sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] graphics grDevices datasets stats utils methods base
other attached packages:
[1] subselect_0.12-2 XML_3.96-1.1 colorspace_1.2-2 RGtk2_2.20.25 rattle_2.6.26
loaded via a namespace (and not attached):
[1] tools_3.0.0
If you want to install it for windows, here it how you can:
install.packages("doMC", repos="http://R-Forge.R-project.org")
I did it for R 3.2.3 version and it works well.
As Erdogan mentioned, it works for R 4.x.x versions as well.
I assume it's not available to you because you're using Windows. The doMC package has never been available on Windows because it depends on the mclapply function, before in the multicore package and now in parallel. I haven't heard of any issues with doMC in R 3.0.0.
The doSMP package was intended to be the Windows alternative to doMC. I believe it was eventually taken off CRAN because of problems building it on newer versions of GCC.
The doParallel and doSNOW packages are probably the most popular foreach backends available for Windows.
I was facing the same issue with RTextTools, as RTextTools is now not available on CRAN.
I have Download RTextTools From Given Link

https://cran.r-project.org/src/contrib/Archive/RTextTools/
and copy RTextTools_1.4.2.tar.gz file in project root folder then run this command in project folder in terminal
"R CMD INSTALL RTextTools_1.4.2.tar.gz"
After running this command I receive below error "ERROR: dependencies ‘SparseM’, ‘randomForest’, ‘tree’, ‘e1071’, ‘ipred’, ‘caTools’, ‘maxent’, ‘glmnet’, ‘tau’ are not available for package ‘RTextTools’"
Now install each dependencies from RStudio or RConsole (Any Editor used by you) by simply running this code
install.packages("caTools")
Install all 9 required packages One By One (In My Case it was 9 Packages Dependencies required by RTextTools) all packages will be installed except 'maxent'
Now download maxent from the given link
https://cran.r-project.org/src/contrib/Archive/maxent/
and copy maxent_1.3.3.1.tar file in project folder then run this command in project folder in terminal
"R CMD INSTALL maxent_1.3.3.1.tar"
Now For RTextTools Run this command again in Terminal
"R CMD INSTALL RTextTools_1.4.2.tar.gz"
All is done Now..
But the Last Step is
Load the RTextTools using
library(RTextTools)
You will see one more Error: Load SparseM Now Loading SparseM use code below
library(SparseM)
and in the last Load RTextTools
library(RTextTools)

Resources