You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This article describes how to use functions in the [**sqlmlutils**](https://github.com/Microsoft/sqlmlutils) package to install new Python packages to an instance of [Machine Learning Services on SQL Server](../sql-server-machine-learning-services.md) and on [Big Data Clusters](../../big-data-cluster/machine-learning-services.md). The packages you install can be used in Python scripts running in-database using the [sp_execute_external_script](https://docs.microsoft.com/sql/relational-databases/system-stored-procedures/sp-execute-external-script-transact-sql) T-SQL statement.
This article describes how to use functions in the [**sqlmlutils**](https://github.com/Microsoft/sqlmlutils) package to install new Python packages to an instance of [Azure SQL Managed Instance Machine Learning Services](/azure/azure-sql/managed-instance/machine-learning-services-overview). The packages you install can be used in Python scripts running in-database using the [sp_execute_external_script](https://docs.microsoft.com/sql/relational-databases/system-stored-procedures/sp-execute-external-script-transact-sql) T-SQL statement.
23
24
::: moniker-end
@@ -43,9 +44,9 @@ For more information about package location and installation paths, see [Get Pyt
43
44
44
45
+ Packages must be compliant with the version of Python you have, and the version of Python on the server must match the version of Python on the client computer. For information on which version of Python is included with each SQL Server version, see the [Python and R versions](../sql-server-machine-learning-services.md#versions). To confirm the version of Python in a particular SQL instance, see [View the version of Python](python-package-information.md#bkmk_SQLPythonVersion).
45
46
46
-
+The Python package library is located in the Program Files folder of your SQL Server instance and, by default, installing in this folder requires administrator permissions. For more information, see [Package library location](../package-management/python-package-information.md#default-python-library-location).
47
+
+Package installation is specific to the SQL instance, database, and user you specify in the connection information you provide to **sqlmlutils**. To use the package in multiple SQL instances or databases, or for different users, you'll need to install the package for each one. The exception is that if the package is installed using the database administrator account, then the package is available to all users in that database.
47
48
48
-
+Package installation is per instance. If you have multiple instances of Machine Learning Services, you must add the package to each one.
49
+
+The Python package library is located in the Program Files folder of your SQL Server instance and, by default, installing in this folder requires administrator permissions. For more information, see [Package library location](../package-management/python-package-information.md#default-python-library-location).
49
50
50
51
+ Before adding a package, consider whether the package is a good fit for the SQL Server environment.
51
52
@@ -93,7 +94,7 @@ You can also install **sqlmlutils** from a zip file:
93
94
94
95
## Add a Python package on SQL Server
95
96
96
-
Using **sqlmlutils**, you can add Python packages to a SQL instance. You can then use those packages in your Python code running in the SQL instance.
97
+
Using **sqlmlutils**, you can add a Python package to a SQL instance. You can then use those packages in your Python code running in the SQL instance. **sqlmlutils** uses [CREATE EXTERNAL LIBRARY](../../t-sql/statements/create-external-library-transact-sql.md) to install the package and each of its dependencies.
97
98
98
99
In the following example, you'll add the [text-tools](https://pypi.org/project/text-tools/) package to SQL Server.
Copy file name to clipboardExpand all lines: docs/machine-learning/package-management/install-additional-r-packages-on-sql-server.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,8 @@ This article describes how to use functions in the [**sqlmlutils**](https://gith
34
34
35
35
### Other considerations
36
36
37
+
- Package installation is specific to the SQL instance, database, and user you specify in the connection information you provide to **sqlmlutils**. To use the package in multiple SQL instances or databases, or for different users, you'll need to install the package for each one. The exception is that if the package is installed using the database administrator account, then the package is available to all users in that database.
38
+
37
39
- R script running in SQL Server can use only packages installed in the default instance library. SQL Server cannot load packages from external libraries, even if that library is on the same computer. This includes R libraries installed with other Microsoft products.
38
40
39
41
- On a hardened SQL Server environment, you might want to avoid the following:
title: "ALTER EXTERNAL LIBRARY (Transact-SQL) | Microsoft Docs"
4
4
ms.custom: ""
5
-
ms.date: 06/10/2020
5
+
ms.date: 08/26/2020
6
6
ms.prod: sql
7
7
ms.reviewer: ""
8
8
ms.technology: machine-learning
@@ -141,7 +141,7 @@ WITH ( LANGUAGE = <language> )
141
141
142
142
**library_name**
143
143
144
-
Specifies the name of an existing package library. Libraries are scoped to the user. Library names are must be unique within the context of a specific user or owner.
144
+
Specifies the name of an existing package library. Libraries are scoped to the user. Library names must be unique within the context of a specific user or owner.
145
145
146
146
The library name cannot be arbitrarily assigned. That is, you must use the name that the calling runtime expects when it loads the package.
147
147
@@ -215,6 +215,8 @@ For the Python language, the package in a .whl or .zip file must be prepared in
215
215
216
216
The `ALTER EXTERNAL LIBRARY` statement only uploads the library bits to the database. The modified library is installed when a user runs code in [sp_execute_external_script (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-execute-external-script-transact-sql.md) that calls the library.
217
217
218
+
A number of packages, referred to as *system packages*, are pre-installed in a SQL instance. System packages cannot be added, updated, or removed by the user.
219
+
218
220
## Permissions
219
221
220
222
By default, the **dbo** user or any member of the role **db_owner** has permission to run ALTER EXTERNAL LIBRARY. Additionally, the user who created the external library can alter that external library.
title: "CREATE EXTERNAL LIBRARY (Transact-SQL) - SQL Server | Microsoft Docs"
4
4
ms.custom: ""
5
-
ms.date: 06/10/2020
5
+
ms.date: 08/26/2020
6
6
ms.prod: sql
7
7
ms.reviewer: ""
8
8
ms.technology: machine-learning
@@ -142,7 +142,9 @@ WITH ( LANGUAGE = <language> )
142
142
143
143
**library_name**
144
144
145
-
Libraries are added to the database scoped to the user. Library names must be unique within the context of a specific user or owner. For example, two users **RUser1** and **RUser2** can both individually and separately upload the R library `ggplot2`. However, if **RUser1** wanted to upload a newer version of `ggplot2`, the second instance must be named differently or must replace the existing library.
145
+
Libraries uploaded to the instance can be either public or private. If the library is created by a member of `dbo`, the library is public and can be shared with all users. Otherwise, the library is private to that user only.
146
+
147
+
Library names must be unique within the context of a specific user or owner. For example, two users **RUser1** and **RUser2** can both individually and separately upload the R library `ggplot2`. However, if **RUser1** wanted to upload a newer version of `ggplot2`, the second instance must be named differently or must replace the existing library.
146
148
147
149
Library names cannot be arbitrarily assigned; the library name should be the same as the name required to load the library in the external script.
148
150
@@ -223,6 +225,8 @@ The `CREATE EXTERNAL LIBRARY` statement uploads the library bits to the database
223
225
224
226
Libraries uploaded to the instance can be either public or private. If the library is created by a member of `dbo`, the library is public and can be shared with all users. Otherwise, the library is private to that user only.
225
227
228
+
A number of packages, referred to as *system packages*, are pre-installed in a SQL instance. System packages cannot be added, updated, or removed by the user.
229
+
226
230
## Permissions
227
231
228
232
Requires the `CREATE EXTERNAL LIBRARY` permission. By default, any user who has **dbo** who is a member of the **db_owner** role has permissions to create an external library. For all other users, you must explicitly give them permission using a [GRANT](https://docs.microsoft.com/sql/t-sql/statements/grant-database-permissions-transact-sql) statement, specifying CREATE EXTERNAL LIBRARY as the privilege.
title: "DROP EXTERNAL LIBRARY (Transact-SQL) | Microsoft Docs"
4
4
ms.custom: ""
5
-
ms.date: 06/10/2020
5
+
ms.date: 08/26/2020
6
6
ms.prod: sql
7
7
ms.reviewer: ""
8
8
ms.technology: machine-learning
@@ -69,6 +69,8 @@ An informational message is returned if the statement was successful.
69
69
70
70
Unlike other `DROP` statements in SQL Server, this statement supports specifying an optional authorization clause. This allows **dbo** or users in the **db_owner** role to drop a package library uploaded by a regular user in the database.
71
71
72
+
A number of packages, referred to as *system packages*, are pre-installed in a SQL instance. System packages cannot be added, updated, or removed by the user.
0 commit comments