Installing packages
Hi all
I have a recurring issue with installing R-packages and using them in BERT functions. Below is one example; segMGarch works at my local R installation, but BERT will not install it.
Warning messages: 1: In install.packages(c("segMGarch")) : installation of package 'gss' had non-zero exit status 2: In install.packages(c("segMGarch")) : installation of package 'Rcpp' had non-zero exit status 3: In install.packages(c("segMGarch")) : installation of package 'mvtnorm' had non-zero exit status Error: package or namespace load failed for 'segMGarch' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called 'Rcpp' In addition: Warning message: package 'segMGarch' was built under R version 3.5.3
Thanks in advance for any helpful suggestions.
Regards Morten
Hi, I'm having similar problems with ggplot2:
install.packages("ggplot2") Installing package into 'C:/Users/vsinhaadm/AppData/Local/BERT2/lib' (as 'lib' is unspecified) --- Please select a CRAN mirror for use in this session ---
There is a binary version available but the source version is later: binary source needs_compilation ggplot2 3.3.0 3.3.2 FALSE
installing the source package 'ggplot2'
trying URL 'https://mirror.niser.ac.in/cran/src/contrib/ggplot2_3.3.2.tar.gz' Content type 'application/x-gzip' length 3054431 bytes (2.9 MB) downloaded 2.9 MB
The downloaded source packages are in 'C:\Users\vsinhaadm\AppData\Local\Temp\3\RtmpC6WTj4\downloaded_packages' Warning message: In install.packages("ggplot2") : installation of package 'ggplot2' had non-zero exit status
I'd really appreciate some help here. I have tried dependencies = TRUE & I have tried installing dependent packages similarly but keep running into non-zero exit status error. Thanks.
Regards, Varun
Hi, the following worked for me:
- Install RTools to be able to install packages from source
- Point Bert to local version of 3.5.3 (3.6 & above don't work for now) by changing preferences (directions on github somewhere)
- Make sure R can write to local version of R folder otherwise it will put the packages in personal library
- Install required package install.packages("ChainLadder",dependencies=TRUE,type="source") using local version of R (or Bert if you prefer)
- I got an error that one package could not be installed from source. I installed the missing package using binary. I installed the rest from source. Seemed to do the trick for now.
Hope it helps. I guess the error was ultimately because the package to be installed requires latest versions of other packages which we can only get in an older version of R by compiling from source...
Hi, I found this solution much easier: Set the CRAN to be a MRAN snapshot from when version 3.5.x was the latest. I set this code in the functions.R:
local({r <- getOption("repos")
r["CRAN"] <- "https://cran.microsoft.com/snapshot/2019-04-15/"
options(repos=r)
})
You only have packages from April 2019, but they install without problems.
I had the same problem, I need ggplot2 for Excel's reports and Bert don't let me install it.
EDIT: Thanks, Ljupch0, that works for me.
Have you tried
install.packages("ggplot2", .Library, repos="https://cran.r-project.org",method="wininet")
MRAN does not work for installations anymore.
You can use the solution below instead reproduced from
https://posit.co/blog/migrating-from-mran-to-posit-package-manager/
local({ r <- getOption("repos") r["CRAN"] <- "https://packagemanager.posit.co/cran/2022-05-04/" options(repos=r) })