Failure to install package from github using devtools - r

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.

Related

GnuTLS Error -50: Cannot install packages from Github in Rstudio?

The following lines prompt an error (which differs from this question):
library(devtools)
install_github("StatsWithR/statsr") # the same for any other open repos
The error is this:
Error: Failed to install 'unknown package' from GitHub:
Error -50 setting GnuTLS cipher list starting with +VERS-TLS1.3
Then I wanted to work around the problem caused by devtools, so I tried githubinstall, but the error became this:
Error in curl::curl_download(input, tmpFile, mode = "wb", quiet = !showProgress) :
Error -50 setting GnuTLS cipher list starting with +VERS-TLS1.3
It seems obvious that the issue is caused by GnuTLS and I found a similar thread: git/jenkins TLS issue, but I cannot find some hints there.
I also tried install_url, install_local, and install_git, but all failed.
Here is the information of the R I recently upgraded from 3.4.4(2018):
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 4
minor 1.2
year 2021
month 11
day 01
svn rev 81115
language R
version.string R version 4.1.2 (2021-11-01)
nickname Bird Hippie
I have been stuck with devtools and install_github. What can I try next?
I installed the r-base and Rstudio using apt install in an existing container, and the default settings(the default r version is 3.4.4) caused the issues I met, then I purged the r environment and created a new one in a new Docker container following this blog: Running RStudio Server with Docker.

R - Unable to install R packages - Cannot open the connection

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.

Failed to install a package. Error: System command error, exit status: -1, stdout + stderr empty,

I've tried to install a package for almost 2 days but installation has not been working by now. I tried a lot of different ways like
install.packages("NIADic_0.0.1.tar.gz", repos = NULL, type = "source")
then
Warning in install.packages :
installation of package ‘NIADic_0.0.1.tar.gz’ had non-zero exit status
and
devtools::install_local('C://Users/pogr1/Desktop/NIADic_0.0.1.tar.gz', force = TRUE)
then
Error: Failed to install 'NIADic' from local:
System command error, exit status: -1, stdout + stderr empty
install.packages("https://github.com/haven-jeon/NIADic/releases/download/0.0.1/NIADic_0.0.1.tar.gz",
lib = .libPaths()[1], repos = NULL, type = "win.binary")
then
cannot open compressed file 'NIADic_0.0.1.tar.gz/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection
and even I reinstalled R, rstudio, and Rtools but still not working
- Session info
------------------------------------------------------------------------
setting value
version R version 3.6.1 (2019-07-05)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate Korean_Korea.949
ctype Korean_Korea.949
tz Asia/Seoul
date 2019-10-31
plz help :(
Although this is a bit old... The package needs RTools for compilation, but then it needs pandoc, package data.table etc. to build vignettes. If you want to proceed easily only with package itself without docs, it should work to have RTools installed and then run:
devtools::install_github('haven-jeon/NIADic/NIADic', build_vignettes = FALSE)

Is MRAN broken?

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/")

Error installing 'ReporteRs' and 'ReporteRsjars'

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).

Resources