Installing stringi repeatedly fails - r

I am trying to install likert, which requires stringi.
install.package("likert") fails to install stringi.
install.package("stringi") from CRAN fails as well:
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/stringi_1.7.6.tgz'
Content type 'application/x-gzip' length 14390020 bytes (13.7 MB)
==================================
downloaded 9.3 MB
Warning in install.packages :
downloaded length 9800943 != reported length 14390020
Warning in install.packages :
URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/stringi_1.7.6.tgz': Timeout of 60 seconds was reached
Error in download.file(url, destfile, method, mode = "wb", ...) :
download from 'https://cran.rstudio.com/bin/macosx/contrib/4.2/stringi_1.7.6.tgz' failed
Warning in install.packages :
download of package ‘stringi’ failed
I downloaded the package from https://cran.r-project.org/web/packages/stringi/index.html and tried installing:
install.packages("~/Desktop/downloads/stringi_1.7.6.tgz", repos = NULL, type = .Platform$pkgType)
But this also failed:
Error: package or namespace load failed for ‘stringi’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/stringi/libs/stringi.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/stringi/libs/stringi.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libR.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/stringi/libs/stringi.so
Reason: image not found
What is going on? I have the latest version of R and R Studio for Mac.

I figured it out. The problem was the timeout. It took too long to load.
I fixed it by changing the timeout from 60seconds to a larger number:
getOption('timeout')
[1] 60
options(timeout=300)

Related

R Error: package or namespace load failed for ‘DNAcopy’ in dyn.load(file, DLLpath = DLLpath, ...):

I have installed an R package in my Macbook (Big Sur), but I am getting error when I use library(packagename). I have uninstalled the R and then reinstalled it, but it is still giving me same error. I am wondering if there are any PATH settings I need to do.
> BiocManager::install("DNAcopy", force = TRUE)
Bioconductor version 3.16 (BiocManager 1.30.19), R 4.2.2 (2022-10-31)
Installing package(s) 'DNAcopy'
trying URL 'https://bioconductor.org/packages/3.16/bioc/bin/macosx/contrib/4.2/DNAcopy_1.72.1.tgz'
Content type 'application/x-gzip' length 510684 bytes (498 KB)
==================================================
downloaded 498 KB
The downloaded binary packages are in
/var/folders/h1/01m4_1gn65g63hvbv15tq7000000gr/T//RtmpEOBgrr/downloaded_packages
> library(DNAcopy)
Error: package or namespace load failed for ‘DNAcopy’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so, 6): Symbol not found: __gfortran_os_error_at
Referenced from: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so
Expected in: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libgfortran.5.dylib
in /Library/Frameworks/R.framework/Versions/4.2/Resources/library/DNAcopy/libs/DNAcopy.so
I would really appreciate any help.
I have tried re-insattling the packages as well as R.

Loading packages in R and RStudio gives image not found error

When trying to load packages in RStudio or R, I get "image not found" errors, e.g.:
> install.packages("Rcpp")
Installing package into ‘/Users/blah/Library/R/4.0/library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/Rcpp_1.0.6.tgz'
Content type 'application/x-gzip' length 3203922 bytes (3.1 MB)
==================================================
downloaded 3.1 MB
The downloaded binary packages are in
/var/folders/q5/9z9mngy52lx6gbjtc_tg5w2wwn7x6k/T//RtmpZwoJ1y/downloaded_packages
> library(Rcpp)
Error: package or namespace load failed for ‘Rcpp’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/blah/Library/R/4.0/library/Rcpp/libs/Rcpp.so':
dlopen(/Users/blah/Library/R/4.0/library/Rcpp/libs/Rcpp.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib
Referenced from: /Users/blah/Library/R/4.0/library/Rcpp/libs/Rcpp.so
Reason: image not found
> detach("package:Rcpp", unload = TRUE)
Error in detach("package:Rcpp", unload = TRUE) : invalid 'name' argument
The same thing happens for many other packages in the User Library e.g. sp, kernlab, gplots, gtools (but not all of them e.g. crayon loads ok). Packages in the System library load fine.
Similar things happen in R, but not with the same set of packages e.g. Rcpp works here but kernlab still does not:
> library(Rcpp)
> detach("package:Rcpp", unload = TRUE)
> library(kernlab)
Error: package or namespace load failed for ‘kernlab’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/blah/Library/R/4.0/library/kernlab/libs/kernlab.so':
dlopen(/Users/blah/Library/R/4.0/library/kernlab/libs/kernlab.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
Referenced from: /Users/blah/Library/R/4.0/library/kernlab/libs/kernlab.so
Reason: image not found
> detach("package:kernlab", unload = TRUE)
Error in detach("package:kernlab", unload = TRUE) :
invalid 'name' argument
I'm running on MacOS 11.2.3 and recently updated XCode (12.4) and CommandLineTools - this seemed to break a few things so I suspect there may be a connection. R is version 4.0.4 and RStudio is version 1.4.1106.
How do I go about trying to fix this?
I fixed this by using brew to uninstall R and Rstudio and reinstalling - but it only worked if I installed R from the cask, although the versions of R and RStudio remained the same.
The main difference I can see is that my new Makeconf file has a -mmacosx-version-min=10.13 flag set for CC, CXX, CXX11 etc (compiler is clang).

rJava does not run on macOS Sierra

I am using macOS Sierra and R version 3.4.0.
I installed the package "rJava" using RStudio:
install.packages("rJava")
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found'
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/rJava_0.9-8.tgz'
Content type 'application/x-gzip' length 627959 bytes (613 KB)
==================================================
downloaded 613 KB
The downloaded binary packages are in
/var/folders/tq/f5jbfqp97y52w_y7byn05_fw0000gn/T//RtmpTdEVbA/downloaded_packages
Then when I try to run rJava I get:
> require(rJava)
Loading required package: rJava
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
R, rJava and Java are little bit messy in macOS. In general, you have to make sure to properly configure all the elements. There is a clash between Oracle's and Apple's version.
Take a look here for very detailed instructions: R, Java, rJava and macOS adventures
I don't post the content here - it's quite long.

knitr package not finding evaluate (OSX Mavericks)

I have attempted to install knitr using RStudio. When I do so, this is what I get
> install.packages("knitr")
also installing the dependency ‘evaluate’
trying URL 'http://cran.rstudio.com/bin/macosx/mavericks/contrib/3.1/evaluate_0.5.5.tgz'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'http://cran.rstudio.com/bin/macosx/mavericks/contrib/3.1/evaluate_0.5.5.tgz'
Warning in install.packages :
download of package ‘evaluate’ failed
trying URL 'http://cran.rstudio.com/bin/macosx/mavericks/contrib/3.1/knitr_1.5.tgz'
Content type 'application/x-gzip' length 863862 bytes (843 Kb)
opened URL
==================================================
downloaded 843 Kb
The downloaded binary packages are in
/var/folders/ym/flmt1pms5vj_wdhtsmwy63pm0000gn/T//RtmpWM2Yqc/downloaded_packages
> library("knitr", lib.loc="/Library/Frameworks/R.framework/Versions/3.1/Resources/library")
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘evaluate’
Error: package or namespace load failed for ‘knitr’
As a result, knitr does not work at all, even on the little test file provided. When I search the CRAN repository for OSX/Mavericks, I am not finding the evaluate package.
Am I doing something wrong; is there a workaround?
I cannot reproduce it. I can see the knitr package under http://cran.rstudio.com/bin/macosx/mavericks/contrib/3.1/
Alternatively you can install from source:
install.packages('evaluate', type = 'source')
I had to also install the formatR package from source on my Windows 7 box:
install.packages('evaluate', type = 'source')
install.packages('formatR', type = 'source')

How to install RtidyHTML on Mac?

Any ideas how I can install RTidyHTML when I get the following error message?
install.packages("RTidyHTML", repos = "http://www.omegahat.org/R", type="source")
trying URL 'http://www.omegahat.org/R/src/contrib/RTidyHTML_0.2-1.tar.gz'
Content type 'application/x-gzip' length 554953 bytes (541 Kb)
opened URL
==================================================
downloaded 541 Kb
* installing *source* package ‘RTidyHTML’ ...
./configure: line 3: make: command not found
ERROR: configuration failed for package ‘RTidyHTML’
* removing ‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RTidyHTML’
You need to install XCode on your Mac if you want to compile from source. (Roman's comment only applies to Windows machines.) I just tried installing it on an XCode-equipped Mac running R 2.13.0 and get first a warning during compliation
ld warning: in libtidy/libtidy.a, file is not of required architecture
installing to /Library/Frameworks/R.framework/Versions/2.13/Resources/library/RTidyHTML/libs/x86_64
... and then get an error during the test load that is part of the install script:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RTidyHTML/libs/x86_64/RTidyHTML.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RTidyHTML/libs/x86_64/RTidyHTML.so, 6): Symbol not found: _tidyBufFree
Referenced from: /Library/Frameworks/R.framework/Versions/2.13/Resources/library/RTidyHTML/libs/x86_64/RTidyHTML.so
Expected in: dynamic lookup
I suppose it is possible that it may compile under a 32 bit version of R on the Mac.64-bit. See Simon Urbanek's web page: for more specifics and some installers for other packages.
EDIT: Installation while running 32bit R from the GUI was successful with a current R (version 2.13.1 RC (2011-07-03 r56263) )

Resources