Unable to launch runtime for ‘R’ script: Check this first

This post is a quickie, hoping that the tip will come in handy to others who are facing the same issue.

Note: the steps below were written for SQL Server 2016 pre-release versions. They are NOT valid for RTM and subsequent releases.

Today I was trying to enable the R Services (a.k.a. Advanced Analytics) feature in SQL Server 2016, which brings the world of R into SQL Server. I thought that I had diligently followed instructions on installing and configuring the integration. Next, I tried to execute the basic script below (sort of like a ‘loopback’ test for this feature to check if the configuration is okay:

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));

Unfortunately it kept returning the error messages below:

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 1, Line 1
An external script error occurred:
Unable to launch the runtime. ErrorCode 0x80070490: 1168(Element not found.).
Msg 11536, Level 16, State 1, Line 1
EXECUTE statement failed because its WITH RESULT SETS clause specified 1 result set(s), but the statement only sent 0 result set(s) at run time.

I went back to the instructions and realized I had forgotten one step which is to download an updated version of the post-installation configuration script from the Microsoft Download Center. Clicking on the previous link actually gives us an updated registerRext.exe. Running the registerRext.exe /uninstall followed by registerRext.exe /install with this updated version fixed my problem!

Do note that the errors mentioned above could have been caused by other issues, but at a minimum please ensure that you are using the updated registerRext.exe.

Comments (5)

  1. If you upgraded to a monthly release of SQL Server 2016 and get ErrorCode 0x80004005 and the ‘unable to launch runtime’ message, you may want to check the NTFS permissions on the folder specified under WORKING_DIRECTORY in the rlauncher.config file. WARNING: it is dangerous to edit these permissions and / or change the path there. Please review https://msdn.microsoft.com/en-US/library/mt590869.aspx for details.

  2. I’ve also seen instances of this error occur when the access to the ExtensibilityData folder is denied (this is typical when moving data folders between machines, or if the OS is re-installed). In some cases, you may be able to workaround for a quick (and perhaps dirty) fix by running the below command (adjusting the path c:\sqldb and MSSQLServer for the instance name) to troubleshoot:

    icacls C:\sqldb\MSSQL13.MSSQLSERVER\MSSQL\ExtensibilityData /T /Grant Users:(F)

  3. jerome says:

    Isuffer the same issue, but none of the solutions is working for me 🙁
    I tried everything you explain here (and found in other blogs and forums) without any success.
    R workd fine before I install the CU2 and still not working after I applied the SP1.
    I unstall it completly and reinstall it, without any change.

    do you have any other ideas?

    1. Hi Jerome – unfortunately it is not possible to tell. You may need to contact Microsoft Support (CSS) to debug this.

  4. Pedro says:

    I’ve installed two times R with SQL 2016, every time I tried to integrate SQL with R I spend hours in it… but it worked fine.
    This month after formatting my PC again, I tried to install again R with SQL 2016. I’m having the same issue related here. Unfortunately, this solution presented here doesn’t work for me… In “Object Explorer > Security > Logins”. It doesn’t show the Login – “NT SERVICE\MSSQLLaunchpad$SQL…” that I used to have before.
    It’s frustrating, I don’t know what to do anymore. I’m not a developer, for me it is getting too difficult to do this integration and getting the information updated.

Skip to main content