My SQL 2019 database queries from within SSMS started throwing errors re communicating with the python runtime, immediately after cloning the operating system solid state drive to a new SSD and installing it into a new computer.
This occurs when trying to run an external python script with
EXEC sp_execute_external_script
The error is:
Msg 39012, Level 16, State 14, Line 2 Unable to communicate with the runtime for 'Python' script for request id: F3A80B16-DEDC-401B-B16A-0D9D8E163CCC. Please check the requirements of 'Python' runtime.
I cloned the computer using Acronis True Image, and the clone completed successfully, with no reported bad sectors or any other errors. I am running Windows 10 Home edition 22H2 with all window updates installed. I am running Microsoft SQL Server 2019 Developer Edition 15.0.2101.7, and using SSMS version 18.8. Running Python 3.7.1. I am running the queries on the actual server itself.
Immediately after cloning, the drive booted successfully on the new computer. I ran Windows update to install any new drivers, and the drivers were the only new updates, as I had previously installed all available updates on the old drive.
I then tested my SQL server database, which is when I discovered this error.
I checked that enable external scripts was enabled, which it is.
I ran some basic code to test the functionality of Python within SQL, and it came up with the same error. That code was:
EXEC sp_execute_external_script
@language = N'Python',
@script = N'
import sys
'
I have tried to re clone the system again, with the same results.
I have ran the python version that SQL server 2019 installed at the following location manually, and it runs normally:
C:\Program Files\Microsoft SQL Server\MSSQL15.servername\PYTHON_SERVICES
I checked the system event logs and there is a python error:
Faulting application name: python.exe, version: 3.7.1150.1013, time stamp: 0x5c0f4332 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc0000005 Fault offset: 0x0000000000000000 Faulting process id: 0x45ac Faulting application start time: 0x01d9bc2d2ecbebd4 Faulting application path: C:\Program Files\Microsoft SQL Server\MSSQL15.servername\PYTHON_SERVICES\python.exe Faulting module path: unknown Report Id: ec2f200f-47ac-433b-83f0-0d1b8bc16033 Faulting package full name: Faulting package-relative application ID:
After reading numerous articles, I've tried enabling Named Pipes from within the SQL Server Configuration Manager, with no change.
I've tried granting full access to the MSSQLLauchpad$Servername account on the Python Services folder located in
"C:\Program Files\Microsoft SQL Server\MSSQL15.servername"
and restarting the server, without success.
I have tested the R runtime with a basic "hello world" script, and that runs successfully.
One article suggested reinstalling Numpy, which I did as well, on the python instance.
Another article suggested loading BIOS defaults, which I did, without any change.
I also added the scripts folder path, located in the folder above, to the system PATH.
I have edited the pythonlauncher.config file to change the working directory to: C:\Program Files\Microsoft SQL Server\MSSQL15.servername\MSSQL\ExtensibilityData
I have upgraded server 2019 to 2022.
I have upgraded SSMS from 18.8 to 19.x.
I have re-cloned twice.
I have also gone back to the original drive, on the original computer, and confirmed that I am not getting that error at all, either with my code, or the test code.
I asked this question on Stack overflow, but haven't had any responses, so thought I would post here too.
Any suggestions greatly appreciated.