RevolutionAnalytics / AzureML

An R interface to AzureML(https://studio.azureml.net/) experiments, datasets, and web services.
Other
46 stars 22 forks source link

magrittr function not found? #125

Closed dimalvovs closed 7 years ago

dimalvovs commented 7 years ago

Hello, magrittr is said to be supported on AzureML, how come this not work?

findNcol <- function(df){ 
   a<-df %>% ncol()
   a %<>% sqrt
   a
  }`

findNcolService <- publishWebService(
  ws,
  fun = findNcol,
  name = "findNcol",
  inputSchema = test1,
  packages = c("magrittr")
)

consume(findNcolService, as.list(test1)) 

output:

converting inputSchema to data frame
Created new folder: C:/Users/DMITRI~1/AppData/Local/Temp/1/RtmpQ3pVnK/dir201d017102f00/packages/bin/windows/contrib/3.1
trying URL 'http://cran.at.r-project.org/bin/windows/contrib/3.1/magrittr_1.5.zip
Content type 'application/zip' length 152098 bytes (148 KB)
opened URL
downloaded 148 KB

> consume(findNcolService, as.list(test1))
Error: AzureML returns error code:
HTTP status code : 400
AzureML error code  : LibraryExecutionError

Module execution encountered an internal library error.
The following error occurred during evaluation of R script: R_tryEval: return error: Error in ..fun(inputDF) : could not find function "%<>%"
andrie commented 7 years ago

It seems you're not loading the package.

Try using library(magrittr) in your code.

dimalvovs commented 7 years ago

Like this?

findNcol <- function(df){ 
  library("magrittr")
  a<-df %>% ncol()
  a %<>% sqrt
  a
}

test1 <- data.frame(a=seq(1:3), b=seq(3:5))

findNcolService <- publishWebService(
  ws,
  fun = findNcol,
  name = "findNcol",
  inputSchema = test1,
  packages = c("magrittr")
)

consume(findNcolService, test1) 

This yields the same error. I had this working, under AzureML 0.2.10, but that one had the doubling environment issue after each API call. After upgrading to 0.2.13 code does not run anymore.

andrie commented 7 years ago

One possibility: check the version of R running in AzureML, and the version of magrittr that gets installed. It's possible that an old version of magrittr gets installed that doesn't contain %<>%

dimalvovs commented 7 years ago

That's exactly what happens! The magrittr 1.0.1 gets installed, and it does have the 'backwards pipe'.