0

I'm trying to get R Statistics running on my Dev server. I'm using this microsoft tutorial.

I have the default installation of R Analytics as provided my the SQL Server installation:

C:\Program Files\Microsoft SQL\Server\MSSQL13.MSSQLSERVER\R_SERVICES\

And I also have the Microsoft R Client 3.4.3 which contains the RX functions installed to:

C:\Program Files\Microsoft\R Client

We have a Tutorial database, with test data, R is enabled and I can do "hello world". Everything works up until Step 3.3 Code Step 3.

> --Save Linear model to table 
> DECLARE @model VARBINARY(MAX); EXEC generate_rental_R_native_model "linear", @model OUTPUT; INSERT INTO
> rental_models (model_name, native_model, lang) VALUES('linear_model',
> @model, 'R');

When I run it I get the following error:

Msg 39004, Level 16, State 20, Line 59 A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004. Msg 39019, Level 16, State 1, Line 59 An external script error occurred: Error in eval(expr, envir, enclos) : could not find function "rxSerializeModel" Calls: source -> withVisible -> eval -> eval

Error in ScaleR. Check the output for more information. Error in eval(expr, envir, enclos) : Error in ScaleR. Check the output for more information. Calls: source -> withVisible -> eval -> eval -> .Call Execution halted

I'm on SQL 2016 SP2 CU3, so I know I don't have the predict() function but everything up until that point should work.

If I run RGUI I can prove that rxSerializeModel is there. This works:

myIris <- iris
myIris[1:5,]
form <- Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width + Species
irisLinMod <- rxLinMod(form, data = myIris)
serializedModel <- rxSerializeModel(irisLinMod)

However if I run this fromSQL, I just get an error.

https://docs.microsoft.com/en-us/machine-learning-server/r-reference/revoscaler/rxsqllibpaths

Msg 39004, Level 16, State 20, Line 10 A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004. Msg 39019, Level 16, State 1, Line 10 An external script error occurred: Error in path.expand(new) : could not find function "rxSqlLibPaths" Calls: source ... .libPaths -> Sys.glob -> path.expand -> path.expand

Error in ScaleR. Check the output for more information. Error in eval(expr, envir, enclos) : Error in ScaleR. Check the output for more information. Calls: source -> withVisible -> eval -> eval -> .Call Execution halted

Why can't SQL see it? Is it a path issue? How do I know where SQL is looking for libraries?

  • Make sure your service account for the SQL Server Launchpad service has access to that demoScripts directory. – AMtwo Dec 11 '18 at 12:34
  • @AMtwo I added permissions for launchpad on both C:\Program Files\Microsoft\R Open & C:\Program Files\Microsoft\R Client and got the same error. – Sir Swears-a-lot Dec 11 '18 at 20:20
  • I get the feeling that SQL is using the wrong instance of the libraries. How do I check or prove where SQL is looking when it's trygin to execute R code? – Sir Swears-a-lot Dec 11 '18 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.