Basic-Excel-R-Toolkit icon indicating copy to clipboard operation
Basic-Excel-R-Toolkit copied to clipboard

Can't load installed packages into BERT version of R

Open PhilWalmsley opened this issue 5 years ago • 5 comments

Hi all,

I'm running into a problem where I can install packages fine using install.packages(), but then the library() function always throws the same error when I try to load them:

Error: package or namespace load failed for 'stringr' in rbind(info, getNamespaceInfo(env, "S3methods")): number of columns of matrices must match (see arg 2) Error: package 'stringr' could not be loaded

Apparently people have seen similar errors when running multiple versions of R (I also have Rstudio running R-3.6.2). But I haven't found how to get around the issue in BERT.

Example code: install.packages("dplyr") library(dplyr)

I've tried to edit the home directory of R in BERT to my other source with BERT.R.home: "C:\R\R-3.6.2", in the preferences but it hasn't helped. Also tried reinstalls of BERT and changing package library to be separate too to try and avoid conflict but that has also failed. I also can't upgrade R to the same version from within R via the installr package because I can't install it due to this problem!

Any ideas much appreciated.

PhilWalmsley avatar Feb 20 '20 12:02 PhilWalmsley

Has this issue been looked into at all?

shaun14 avatar Aug 18 '20 11:08 shaun14

I ran into the same issue and I also tried changing the path environment on windows to point to another installation of R, which didn't work (it seemed to continue to load 3.5.0 that was installed with BERT). I also tried removing 3.5.0 and installing a new version of R into the BERT subfolder this did not work as when I opened BERT the console did not load, I am thinking believe that BERT may not work with versions of R newer than 3.5.0. I also tried seeing if any of the code in the BERT subfolder was looking for R version 3.5.0 but couldn't find anything, I may try installing a new version of R into the 3.5.0 subfolder and see if this works.

The only other workaround I can think of is to install prior versions of the packages we need that were build under 3.5.0 or earlier.

viertelasiat avatar Sep 01 '20 07:09 viertelasiat

I think I have the same issue, although I am not sure. I try to install package Caret which gives this response:

> install.packages("caret")
Installing package into 'C:/Users/Me/AppData/Local/BERT2/lib'
(as 'lib' is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependencies 'rlang', 'tidyselect', 'recipes'


  There are binary versions available but the source versions are later:
           binary source needs_compilation
rlang       0.4.5  0.4.7              TRUE
tidyselect  1.0.0  1.1.0             FALSE
recipes    0.1.10 0.1.13             FALSE

  Binaries will be installed
trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/rlang_0.4.5.zip'
Content type 'application/zip' length 1115838 bytes (1.1 MB)
downloaded 1.1 MB

trying URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/caret_6.0-86.zip'
Content type 'application/zip' length 6245729 bytes (6.0 MB)
downloaded 6.0 MB

package 'rlang' successfully unpacked and MD5 sums checked
package 'caret' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\boers\AppData\Local\Temp\Rtmp88ObwB\downloaded_packages
installing the source packages 'tidyselect', 'recipes'

trying URL 'https://cloud.r-project.org/src/contrib/tidyselect_1.1.0.tar.gz'
Content type 'application/x-gzip' length 90842 bytes (88 KB)
downloaded 88 KB

trying URL 'https://cloud.r-project.org/src/contrib/recipes_0.1.13.tar.gz'
Content type 'application/x-gzip' length 633375 bytes (618 KB)
downloaded 618 KB


The downloaded source packages are in
        'C:\Users\boers\AppData\Local\Temp\Rtmp88ObwB\downloaded_packages'
Warning messages:
1: In install.packages("caret") :
  installation of package 'tidyselect' had non-zero exit status
2: In install.packages("caret") :
  installation of package 'recipes' had non-zero exit status

I have tried to uninstall package Recipes and install it manually although this does not succeed. It still gives this repsonse:

2: In install.packages("recipes") :
  installation of package 'recipes' had non-zero exit status

If I try to load Caret it gives this response:

> library(caret)
Loading required package: lattice
Loading required package: ggplot2
Error: package or namespace load failed for 'caret' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 there is no package called 'recipes'
In addition: Warning messages:
1: package 'caret' was built under R version 3.5.3
2: package 'lattice' was built under R version 3.5.3

I can install and load Caret on the same pc with the stand-alone R application, version 4.0.2.

Do you think this is caused by the same issue as above?

marboe123 avatar Sep 01 '20 14:09 marboe123

This worked for me: 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. You can also try installing packages from github to get newer stuff.

Ljupch0 avatar Mar 13 '21 21:03 Ljupch0

Have you tried the R command

install.packages("stringr", .Library, repos="https://cran.r-project.org",method="wininet")

StatsMan1953 avatar Feb 12 '22 16:02 StatsMan1953