0

I was planning to execute python scripts in Sql Server Management Studio but first I have to install some missing library/packages first so the script can properly run. I was using sqlmlutils to install these python packages in SQL Server but there seems to be an error while running the following scripts:

import sqlmlutils
connection = sqlmlutils.ConnectionInfo(server="myserver", database="mydatabase", uid="myid", pwd="mypassword")
sqlmlutils.SQLPackageManager(connection).install("pandas-profiling")

And this is the error I'm getting from Spyder console:

Incorrect syntax near 'Python'. Traceback (most recent call last):

File "", line 1, in runfile('C:/Users/.../Desktop/abc.py', wdir='C:/Users/.../Desktop')

File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace)

File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/.../Desktop/abc.py", line 3, in sqlmlutils.SQLPackageManager(connection).install("pandas_profiling")

File "C:\ProgramData\Anaconda3\lib\site-packages\sqlmlutils\packagemanagement\sqlpackagemanager.py", line 74, in install self._install_from_pypi(package, upgrade, version, install_dependencies, scope, out_file=out_file)

File "C:\ProgramData\Anaconda3\lib\site-packages\sqlmlutils\packagemanagement\sqlpackagemanager.py", line 151, in _install_from_pypi self._install_from_file(target_package_file, scope, upgrade, out_file=out_file)

File "C:\ProgramData\Anaconda3\lib\site-packages\sqlmlutils\packagemanagement\sqlpackagemanager.py", line 174, in _install_from_file self._install_many(target_package_file, dependencies_to_install, scope, out_file=out_file)

File "C:\ProgramData\Anaconda3\lib\site-packages\sqlmlutils\packagemanagement\sqlpackagemanager.py", line 189, in _install_many raise RuntimeError("Package installation failed, installed dependencies were rolled back.") from e

RuntimeError: Package installation failed, installed dependencies were rolled back.

May I ask if anyone here had the same error? I am using Sql Server 2017 by the way. Any help is much appreciated.

anhnguyen
  • 19
  • 1
  • 4

0 Answers0