Machine Learning Services 2017 - Unable to launch the ( python ) runtime. ErrorCode 0x80070057: 87(The parameter is incorrect.)


We changed over our SQL server 2017 with Machine learning Services ( MLS ) from running R 3.3.3 and Python 3.5.2 - to R 3.5.2 and Python 3.7.1.

SQL 2017 CU22 installs the higher value of R & Python, so you then have to run an exe to tell SQL to use the higher R & Python versions that were installed on disk via CU22.

After this was done successfully, when we went to restart Python we got the error :

Msg 39021, Level 16, State 1, Line 0
Unable to launch runtime for 'Python' script. Please check the configuration of the 'Python' runtime.
Msg 39019, Level 16, State 2, Line 0
An external script error occurred: 
Unable to launch the runtime. ErrorCode 0x80070057: 87(The parameter is incorrect.).

This is a problem description and placeholder for the solution below.

See below for a solution that worked successfully .

asked on Stack Overflow Feb 24, 2021 by steve • edited Feb 25, 2021 by steve

1 Answer


If you look inside

E:\Program Files\Microsoft SQL Server\MSSQL14.< instance >\MSSQL\Log\ExtensibilityLog in the pythonlauncher.lor or rlauncher.log files, you may see a line that looks similar to this :

 [0000293C][00002B9C][Error] Session creation failed with: F

This is I think is the attempt by SQL 2017 MLS to write to disk.

The fix that worked for us :

(1) Create a new directory e.g. D:\MLSTEMP

(2) Create subdirectories D:\MLSTEMP\ < SQL_instance >00 and D:\MLSTEMP\ < SQL_instance >01

(3) Make sure the local MSSQLLaunchpad service, Everyone group & SQL service account has full access to both the D:\MLSTEMP and the sub dirs.

Note : the < > brackets are not part of the directory name

Note: launchpad service name is : NTService\MSSQLLaunchpad$ < instance_name >

(4) Go to your

D:\Program Files\Microsoft SQL Server\MSSQL14.SQL001\MSSQL\Binn\pythonlauncher.config


D:\Program Files\Microsoft SQL Server\MSSQL14.SQL001\MSSQL\Binn\rlauncher.config files,

and alter the WORKING_DIRECTORY setting in each file to be WORKING_DIRECTORY=D:\MLSTEMP

(5) Restart the MSSQLLaunchpad service on the box.

Interestingly, the ****01 directory is the one that's used, not the ****00 dir.

To get more detailed info in the rlauncher or pythonlauncher log files, in the rlauncher or pythonlauncher.config files, change the trace_level setting to 4 i.e. TRACE_LEVEL=4. Its normally set to 1.

It should now work. You may have to play with permissions a bit.

HTH someone....

answered on Stack Overflow Feb 24, 2021 by steve • edited Feb 24, 2021 by steve

User contributions licensed under CC BY-SA 3.0