Hello @Mantini, Ronald M ,
Welcome to Microsoft Q&A!
>When calling Python from SSMS using sp_execute_external_script, I get the below error:Msg 39012, Level 16, State 14, Line 0
I tried to install SQL Server and machine learning service (Python) on another disk other than the C drive (the default location used by the SQL Server installation), and then I also encountered this problem when I ran any script with sp_execute_external_script in SSMS.
What needs to be mentioned is that the SQL Server instance I installed on the C drive will not be a problem. So reinstalling the SQL Server instance on the C drive indeed is a solution.
After some searching, I found a solution. My SQL Server is installed on the E drive (E:\SQLServer2019),the instance name is lucky.
You need to find and open E:\SQLServer2019\MSSQL15.LUCKY\MSSQL\Binn\pythonlauncher.config, which can be opened with Notepad. If you are prompted to deny access when modify it, you need to provide "full control" permission for the current account that logs in to windows.
Then edit this line:
WORKING_DIRECTORY=E:\ProgramData\LUCKY\Temp-PY
To:
WORKING_DIRECTORY=E:\SQLServer2019\MSSQL15.LUCKY\MSSQL\ExtensibilityData
Read the following blog to get inspired.
https://www.sqlservercentral.com/articles/fixing-mls-python-services-to-load-the-runtime
Best Regards,
Cris