microsoft / sqlmlutils

Utility functions for easier usage of SQL Server Machine Learning Services
Other
32 stars 33 forks source link

R Package Installation Fails on dependant package cpp11 #93

Closed rmeans closed 2 years ago

rmeans commented 2 years ago

When installing packages such as tidyverse, broom and haven that depend on the package cpp11, sqlmlutils fails with the error:

Resolving package dependencies for (haven)... Downloading package [1/7] readr (2.0.2)... Downloading package [2/7] cpp11 (0.4.0)... Warning in utils::download.packages(pkg$Package, destdir = destdir, available = binaryPackages, : no package 'cpp11' at the repositories Could not find binary version in repo, trying source instead... Found source package, building into a binary package... Error: Failed to download package cpp11.

My install (install_packages.R) script is as follows:

library(sqlmlutils)
connection <- connectionInfo(
  server   = "XXXXX",
  database = "XXXXX")

r = getOption("repos")
r["CRAN"] = "http://cran.us.r-project.org"
options(repos = r)

sql_install.packages(connectionString = connection, pkgs = "haven", verbose = TRUE, scope = "PUBLIC")

I am running the script with the command: C:\Program Files\R\R-3.5.2\bin>RScript.exe "C:\Temp\install_packages.R"

I am able to install the package into R on the same machine without issue C:\Program Files\R\R-3.5.2\bin>R.exe -e "install.packages('haven', type='binary', repos = 'http://cran.us.r-project.org')"

jarupatj commented 2 years ago

Please set the "CRAN" repository to https://mran.microsoft.com/snapshot/2019-02-01

r["CRAN"] = "https://mran.microsoft.com/snapshot/2019-02-01"

This will use Microsoft time machine feature which mirror CRAN repository at a point which contains compatible packages for R3.5.2 version. https://mran.microsoft.com/timemachine

The latest haven package contains a source package dependency. We do not support source package in SQL Server in windows.