ahmed salah

ahmed salah

  • 1.1k
  • 660
  • 42.1k

When run Python script from SQL server 2017 get error ?

Apr 18 2022 12:50 PM

when run python script from sql server  2017 I get error

Msg 39004, Level 16, State 20, Line 0
A 'Python' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Msg 39019, Level 16, State 2, Line 0
An external script error occurred: Error in execution.  Check the output for more information.
Traceback (most recent call last):File "", line 5, in File "D:\ProgramData\MSSQLSERVER\Temp-PY\Appcontainer1\3E1B378D-D357-4C9C-991B-F07D4A51A5AC\sqlindb_0.py", line 31, in transformfor i in pip.get_installed_distributions():
AttributeError: module 'pip' has no attribute 'get_installed_distributions'SqlSatelliteCall error: Error in execution.  Check the output for more information.
STDOUT message(s) from external script: 
SqlSatelliteCall function failed. Please see the console output for more information.
Traceback (most recent call last):File "D:\SQL Data\MSSQL15.MSSQLSERVER\PYTHON_SERVICES\lib\site-packages\revoscalepy\computecontext\RxInSqlServer.py", line 605, in rx_sql_satellite_callrx_native_call("SqlSatelliteCall", params)File "D:\SQL Data\MSSQL15.MSSQLSERVER\PYTHON_SERVICES\lib\site-packages\revoscalepy\RxSerializable.py", line 375, in rx_native_callret = px_call(functionname, params)
RuntimeError: revoscalepy function failed.

so how to solve issue please ?

when install sql server 2017 i add python option

What I have tried:

EXECUTE sp_execute_external_script
@language =N'Python',
@script=N'import pip
for i in pip.get_installed_distributions():
    print(i)';
GO

 


Answers (1)