I am having some trouble installing packages in R on CentOS after updating R. Here is an example of what happens when I try to install a package in R:
> install.packages("ggplot2")
Installing package into '/home/albers/R/x86_64-pc-linux-gnu-library/3.2'
(as 'lib' is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
internet routines cannot be loaded
In addition: Warning message:
In download.file(url, destfile = f, quiet = TRUE) :
unable to load shared object '/usr/local/lib64/R/modules//internet.so':
/usr/local/lib64/R/modules//internet.so: undefined symbol: curl_multi_wait
HTTPS CRAN mirror
1: 0-Cloud [https] 2: Austria [https]
3: Chile [https] 4: China (Beijing 4) [https]
5: Colombia (Cali) [https] 6: France (Lyon 2) [https]
7: France (Paris 2) [https] 8: Germany (M▒nster) [https]
9: Iceland [https] 10: Mexico (Mexico City) [https]
11: Russia (Moscow) [https] 12: Spain (A Coru▒a) [https]
13: Switzerland [https] 14: UK (Bristol) [https]
15: UK (Cambridge) [https] 16: USA (CA 1) [https]
17: USA (KS) [https] 18: USA (MI 1) [https]
19: USA (TN) [https] 20: USA (TX) [https]
21: USA (WA) [https] 22: (HTTP mirrors)
Selection: 1
Warning: unable to access index for repository https://cran.rstudio.com/src/contrib:
internet routines cannot be loaded
Warning message:
package 'ggplot2' is not available (for R version 3.2.5)
So I spent some time searching the error messages. I updated my version of curl which now is up to date:
$ curl -V
curl 7.48.0 (x86_64-pc-linux-gnu) libcurl/7.48.0 zlib/1.2.8
Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
Features: IPv6 Largefile libz UnixSockets
Still unable to install packages and am receiving the same error message. So I tried following the instructions of this post , specifically adding the following command to my .bash_profile:
export LD_LIBRARY_PATH=$TOOLS/curl-7.48.0/lib:$LD_LIBRARY_PATH
Again I get the same error message about R unable to load shared objects. Ultimately this is a download issue as download.file fails as well. Here is my sessionInfo():
R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.2 (Final)
locale:
[1] LC_CTYPE=en_US.iso885915 LC_NUMERIC=C
[3] LC_TIME=en_US.iso885915 LC_COLLATE=en_US.iso885915
[5] LC_MONETARY=en_US.iso885915 LC_MESSAGES=en_US.iso885915
[7] LC_PAPER=en_US.iso885915 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.iso885915 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
I am able to download files with wget and curl but as soon as I start R, I unable to download anything.
Does anyone have any suggestions on how I might get around this issue?
Try it like this.
install.packages("ggplot2", repos="http://cran.cnr.berkeley.edu")
or just before you install it change your download tool to something else ie on Linux you can try wget as follows.
options(download.file.method = "wget")
Note, I've dropped the https for http. I had a similar error...
Selection: 1
Warning: unable to access index for repository https://cran.rstudio.com/src/contrib:
unsupported URL scheme
Warning message:
package ‘ggplot2’ is not available (for R version 3.2.3)
If you look at the output of the following line from your question...
Yours
Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
Mine (Also Centos 6)
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Your curl is missing https support. There was an error regarding curl_multi_wait in your output as well. This was added in 7.28.0.
https://curl.haxx.se/libcurl/c/curl_multi_wait.html
If you need to build curl locally do this
mkdir -p $HOME/curl
cd $HOME/curl
git clone https://github.com/curl/curl.git
cd curl
bash buildconf
./configure --prefix=$HOME/libcurl
make
make install
At this point you need to setup your LD_LIBRARY_PATH in .bash_profile ie
export LD_LIBRARY_PATH=$HOME/libcurl/lib:$LD_LIBRARY_PATH
Then either logout and back in again or
source ~/.bash_profile
I believe I answered a similar question once before following the R 3.2.* upgrade last summer. Travis CI using Ubuntu 12.04 has similar issues.
One rather simple way around it is to tell R to use the external wget or curl binary you may have (and which needs to be https-ready) to download. So try eg
R> options("download.file.method"="wget")
which, when set, allows me to download your desired package from the desired non-https host:
R> install.packages("ggplot2", repos="http://cran.cnr.berkeley.edu")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
--2016-04-26 18:29:16-- http://cran.cnr.berkeley.edu/src/contrib/ggplot2_2.1.0.tar.gz
Resolving cran.cnr.berkeley.edu (cran.cnr.berkeley.edu)... 169.229.201.201, 2607:f140:0:8000::201
Connecting to cran.cnr.berkeley.edu (cran.cnr.berkeley.edu)|169.229.201.201|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1571788 (1.5M) [application/x-gzip]
Saving to: ‘/tmp/RtmpwWvA3s/downloaded_packages/ggplot2_2.1.0.tar.gz’
/tmp/RtmpwWvA3s/downloaded_packages/ggplot2_2.1.0.ta 100%[========================================================================================================================>] 1.50M 1.32MB/s in 1.1s
2016-04-26 18:29:17 (1.32 MB/s) - ‘/tmp/RtmpwWvA3s/downloaded_packages/ggplot2_2.1.0.tar.gz’ saved [1571788/1571788]
* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (ggplot2)
The downloaded source packages are in
‘/tmp/RtmpwWvA3s/downloaded_packages’
You can set options in ~/.Rprofile or the corresponding Rprofile.site.
Related
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.
After installing R version 4.2.0, I was suddenly unable to install packages from CRAN. This was only true from my office site which has a strong firewall.
Warning message pasted below:
> Warning in install.packages: unable to access index for repository
> http://cran.rstudio.com/src/contrib: cannot open URL
> 'http://cran.rstudio.com/src/contrib/PACKAGES' Installing package into
> ‘C:/Users/l2863/AppData/Local/R/win-library/4.2’ (as ‘lib’ is
> unspecified) Warning in install.packages: unable to access index for
> repository http://cran.rstudio.com/src/contrib: cannot open URL
> 'http://cran.rstudio.com/src/contrib/PACKAGES'
I reviewed the similar questions and did not find any solutions that worked.
Installing CRAN packages was restored by going into the Rstudio global options and setting the Primary CRAN repository to USA (TX 1) [https] - Revolution Analytics, Dallas, TX.
I don't know why this worked, whereas selecting USA (TN) [https] - National Institute for Computational Sciences, Oak Ridge did not work.
My company's cyber security engineer stated that the TX location "seemingly points to one specific location, unlike the others."
I found a solution here , it worked with me using R studio on Windows
Go to Tools -> Global Options -> Packages-> Management Tab-> Uncheck "Use secure download method for HTTP"
However, if you prefer to maintain https connection for installing R packages, please refer to this link for more details
If you have this option enabled and still receive a warning message it’s likely you need to select an alternate CRAN mirror that supports HTTPS. Mirrors currently known to support HTTPS are enumerated below in Secure CRAN Mirrors. It’s also possible that you’ve manually specified a download method or CRAN mirror in your .Rprofile that doesn't support secure downloads
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).
I have tried to install the newly released R package called "BelgiumStatistics". This package contains all the datasets released by Statistics Belgium (Bevolking, Werk, Leefmilieu, Census 2011). The related information to the data and the package is available through several links attached here:
1. Open Data in Belgium - release of BelgiumStatistics R package
2. Open Data of Belgium - provided at GitHub
The problem is that I get a timeout error after doing exactly what the instruction says:
library(devtools)
devtools::install_github("jwijffels/StatisticsBelgium", subdir ="BelgiumStatistics")
Downloading GitHub repo jwijffels/StatisticsBelgium#master
Error in curl::curl_fetch_memory(url, handle = handle) :
Timeout was reached
traceback()
13: .Call(R_curl_fetch_memory, url, handle)
12: curl::curl_fetch_memory(url, handle = handle)
11: request_fetch.write_memory(req$output, req$url, handle)
10: request_fetch(req$output, req$url, handle)
9: request_perform(req, hu$handle$handle)
8: httr::HEAD(src_submodules, , auth)
7: github_has_remotes(x, auth)
6: remote_download.github_remote(remote, quiet = quiet)
5: remote_download(remote, quiet = quiet)
4: FUN(X[[i]], ...)
3: vapply(remotes, install_remote, ..., FUN.VALUE = logical(1))
2: install_remotes(remotes, ...)
1: devtools::install_github("jwijffels/StatisticsBelgium", subdir = "BelgiumStatistics")
I have seen several issues discussed here, such as :
install_github doesn't work
Error while using install_github | devtools | timeout issue
Solution. How to install_github when there is a proxy
But they were not useful in my case, since I do not have any problems with proxy or downloading other packages for example from Cran . By the way, I am using RStudio (Version 0.99.486 ) with R version 3.2.2 (2015-08-14) installed on Windows 7 and I have the latest version of Rtools installed (Rtools33).
I wonder that whether it is the problem of this package which has about 100MB or the GitHub itself. I downloaded the package from GitHub and I tried to install the package from zip file or even pasting it directly to the place that I have all the other libraries installed (i.e. C:\Users\xxx\Documents\R\win-library) but it failed too. So, What could be the solution?
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.