x

R Script in SQL 2017

Hi Folks,

Lately we moved to SQL 2017 and while trying to execute R script I am receiving the below error.

"Msg 39021, Level 16, State 1, Line 1 Unable to launch runtime for 'R' script. Please check the configuration of the 'R' runtime. Msg 39019, Level 16, State 2, Line 1 An external script error occurred: Unable to launch the runtime. ErrorCode 0x80004005: ."

Script used is below.

exec sp_execute_external_script @language=N'R', @script=N'OutputDataSet<-InputDataSet', @input_data_1=N'Select 1 as col' with result sets (([col] int not null));

Script is working fine for Python.

EXEC sp_execute_external_script @language =N'Python', @script=N'OutputDataSet = InputDataSet', @input_data_1 = N'SELECT 1 AS col'

Any suggestions how can I proceed and check for the possible issues.

more ▼

asked Feb 05 at 02:32 PM in Default

avatar image

lokeshlehkara
11 1 3 4

@lokeshlehkara It looks like the SQL Server Launchpad is not running. Please check.

Feb 05 at 02:35 PM Oleg

@Oleg already checked. It working fine. if that was the case then Python script should have given the same error, isn't it?

Feb 05 at 05:46 PM lokeshlehkara
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

I don't have SQL Server 2017, but experienced similar problems with R Services (in database) for SQL Server 2016. From what I understand, the most common culprit is the R version mismatch. For example, if SQL Server RTM is installed (without R) and later upgraded to SP1 then using the RTM disk to add R services will not install them properly. Installing machine learning components without internet access lists the matching versions of the cab files for both R (SRO, SPS) and Python (SPO, SPS). One of the ways to fix this problem is to uninstall R Services and then run the setup again to install them.

With 2017, you can try the following: open elevated command prompt, change directory to wherever the SQL Server 2017 setup file is located and use

 setup.exe /q 
     /Action=Uninstall 
     /Features=SQL_INST_MR 
     /InstanceName=MSSQLSERVER

or whatever you instance name is. If this barks then try to change the features to read this (other flags are the same)

 /Features=AdvancedAnalytics, SQL_INST_MR 

This should silently uninstall just the R Services (The value for Python is SQL_INST_MPY). After that invoking setup normally and opting the route to add features to existing instance should show the R Services box unchecked (so you can now check it) and proceed. From what I experienced, this is a far better option then attempting to reinstall/repair SQL Server installation.

After install completes, restart the SQL Server Services (which will also cause the restart of the launchpad). I am not sure why, but when I tried to test R via round trip similar to yours, I received a very obscure error message stating something like the R Services is configured but is not ready yet so please wait until it is ready. Restarting the SQL Server service (and launchpad) cured this issue.

One more point I would like to mention is "big brother". If you have the domain policies which will mess with configuration settings by the means of logon scripts then everything might work like a clock until the box is restarted, at which time the big brother's logon script might mess something up.

Hope this helps.

Oleg

more ▼

answered Feb 09 at 08:11 AM

avatar image

Oleg
19.8k 3 7 28

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x258
x2

asked: Feb 05 at 02:32 PM

Seen: 48 times

Last Updated: Feb 09 at 08:11 AM

Copyright 2018 Redgate Software. Privacy Policy