0

This is my first post - thusfar I have learnt a lot from the community just by browsing and I am grateful for it, thank you. However, with this one I am completely stuck. I am still new to R and programming, and while I am very successful with analytics and statistics, my computer science knowledge is lacking.

My situation is special: I am attempting to set up R and R Studio on a corporate laptop that has many restrictions, one being limited internet access. I need to start installing packages, but I cannot do it in the usual way as internet traffic is restricted. To this end, I have downloaded everything I require on another machine and intend to install it locally on the restricted laptop. Using dplyr and its dependencies (just two for now) as an example:


    #download packages on internet-enabled machine
    packages <- c("dplyr", "generics", "glue")
    files <- download.packages(pkgs = packages, destdir = getwd(), type = "win.binary")
    files[,2]
    [1] "dplyr_1.0.9.zip"    "generics_0.1.3.zip" "glue_1.6.2.zip"  
      
    #transfer files to restricted laptop and install manually
    install.packages(files[,2], repos = NULL, type = "win.binary")

I get an error when I try to install the first and third package (second one installs ok):


    package ‘dplyr’ successfully unpacked and MD5 sums checked
    Error in install.packages : package ‘dplyr’ not installed because it is not built for UCRT

These are my R specs:

$platform
[1] "x86_64-w64-mingw32"

$arch
[1] "x86_64"

$os
[1] "mingw32"

$crt
[1] "ucrt"

$system
[1] "x86_64, mingw32"

$status
[1] ""

$major
[1] "4"

$minor
[1] "2.1"

$year
[1] "2022"

$month
[1] "06"

$day
[1] "23"

$`svn rev`
[1] "82513"

$language
[1] "R"

$version.string
[1] "R version 4.2.1 (2022-06-23 ucrt)"

$nickname
[1] "Funny-Looking Kid"

I understand that my R version is URCT, which is Universal C Runtime (CRT), but I don't even know what that means in practice. I understand that older versions of R are not URCT and installing them would solve the issue, as was suggested in other posts e.g.

ROracle - fails to install as "not built for UCRT"

Error in install.packages : package ‘RGtk2’ not installed because it is not built for UCRT

package ‘rsgcc’ not installed because it is not built for UCRT

However, the R version I am using is the only one approved by my company, and I cannot install a different version.

It seems unreasonable that is impossible to install packages in this version of R, so I am surely missing something big time, hence seeking help for more knowledgeable people.

  • how can install packages manually on a internet-restricted laptop running R version 4.2.1 URCT?
  • can someone briefly explain what the URCT business is about and why is it causing issues with such a basic task like installing basic packages?

Thank you very much!

Michał

michal
  • 1
  • 2

1 Answers1

1

Hopefully OP has solved this by now. I was able to find a simple and generalizable solution from this link: https://cran.r-project.org/bin/windows/base/howto-R-devel.html

This is how I see the problem (I am also a beginner): your R uses UCRT, but the binary file you downloaded was written for non-UCRT. The fix is to install "from source" to force R to build its own binary files. The binaries will inherit UCRT compatibility from the R version they were built with.

The suggested solutions are as follows:

  1. Specify to install from source, forcing your UCRT system to build appropriate binaries: install.packages("dplyr", type="source")
  2. Use devtools to install/build from GitHub (this is what I used with my internet limitations at work): devtools::install_github("cran/dplyr")

Extrapolating this to your snippet above, I'd recommend trying this:

#download packages on internet-enabled machine
packages <- c("dplyr", "generics", "glue")
files <- download.packages(pkgs = packages, destdir = getwd(), type = "source") #Changed type to source
files[,2]
[1] "dplyr_1.0.9.tar.gz"    "generics_0.1.3.tar.gz" "glue_1.6.2.tar.gz"  
  
#transfer files to restricted laptop and install manually
install.packages(files[,2], repos = NULL, type = "source") #changed type to source
shebdon
  • 11
  • 3