cannot read workspace version 3 written by R 3.6.0; need R 3.5.0 or newer

June 18, 2019 @w_t_bradley Tyler Bradley

@w_t_bradley wrote:

I'm running into this error when I build a company internal package on my laptop, move it to SQL Server, and then attempt to create an external library. The SQL Server instance has R version 3.4.3 (2017-11-30) and I do have R-3.6.0 installed on my laptop. There was a change in the workspace format version from 2 to 3 with R-3.5.0. So I think I get why this error is happening, but I can't fix it or pin point the exact step it occurs.

I have switched to using R-3.4.3 by installing it and changing it under Global Options in RStudio. I had to install all the necessary packages after that.

Here's by basic code:

# This should switch to version 2 for everything

# Build a little model for testing
data_set <- data.frame(x1 = c(rnorm(10, mean = 2.5, sd = .1),
                              rnorm(10, mean = 7.5, sd = .1),
                              rnorm(10, mean = 2.5, sd = .1),
                              rnorm(10, mean = 7.5, sd = .1)),
                       x2 = c(rnorm(10, mean = 2.5, sd = .1),
                              rnorm(10, mean = 7.5, sd = .1),
                              rnorm(10, mean = 7.5, sd = .1),
                              rnorm(10, mean = 2.5, sd = .1)),
                       y = c(rep(0, 20), rep(1, 20)))
tree_mod <- xgboost(data = as.matrix(data_set[, c("x1", "x2")]), label = data_set$y,
                    nrounds = 2)

Then I save this model for use in the internal package.

usethis::use_data(tree_mod, internal = TRUE, overwrite = TRUE, version = 2) # Should use version 2

# Using devtools
check() # Warning: package 'xgboost' was built under R version 3.4.4
devtools::build(binary = TRUE) 
# I am getting "-  using R version 3.4.3 (2017-11-30)" in the output

I also have an exported function that uses this model to predict to observations. I can install this on my laptop and everything is working.

Then I copy the zip file over to SQL Server and run this code:
which results in the error.

I've tried everything I can find (environment variables, switch R versions, checking function parameter options, double checking moving the right files). I had this set up working previously and I guessing updating R broke it somehow, but I could be wrong. I have no clue how I'm still getting R 3.6.0 in the error message since switching to R 3.4.3 should have fixed that.

My next steps are to wipe R from my laptop, reset it all up again using only R 3.4.3, and use the checkpoint package to only use older packages. But I feel like that's pretty drastic and there should be an easier way.

Posts: 4

Participants: 4

Read full topic

Previous Article
FEAR 2.0.1 in R 3.6.0
FEAR 2.0.1 in R 3.6.0

@rparente wrote: Hi, I'm trying to install FEAR and the following msg appears: E...

Next Article
Not able to trigger the graphics using RSTUDIO
Not able to trigger the graphics using RSTUDIO

@bibhusisa wrote: Hi , I have added the parameter as rsession-which-r=/opt/cloud...