Skip to content

Commit e20fcf3

Browse files
committed
Merge branch 'master' of https://github.com/MicrosoftDocs/sql-docs-pr into 20180109_SP2DistributedTransaction
2 parents 0f11428 + c29ce24 commit e20fcf3

32 files changed

Lines changed: 593 additions & 404 deletions

docs/advanced-analytics/TOC.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,14 @@
9797
## [Package management](r/r-package-management-for-sql-server-r-services.md)
9898
### [Default packages](r/installing-and-managing-r-packages.md)
9999
### [Get package information](r/determine-which-packages-are-installed-on-sql-server.md)
100-
### [Install new R packages](r/install-additional-r-packages-on-sql-server.md)
101100
### [Install new Python packages](python/install-additional-python-packages-on-sql-server.md)
102-
### R-only
101+
### [Install new R packages](r/install-additional-r-packages-on-sql-server.md)
102+
#### [Use R package managers](r/install-additional-r-packages-on-sql-server.md)
103+
#### [Use RevoScaleR](r/use-revoscaler-to-manage-r-packages.md)
104+
#### [Use T-SQL](r/install-r-packages-tsql.md)
105+
#### [Use a miniCRAN repo](r/create-a-local-package-repository-using-minicran.md)
103106
#### [Enable remote R package management](r/r-package-how-to-enable-or-disable.md)
104-
#### [RevoScaleR functions for R package management](r/use-revoscaler-to-manage-r-packages.md)
105-
#### [R package synchronization](r/package-install-uninstall-and-sync.md)
106-
#### [miniCRAN for local R package repository](r/create-a-local-package-repository-using-minicran.md)
107+
#### [Synchronize R packages](r/package-install-uninstall-and-sync.md)
107108
#### [Workarounds for R "user libraries"](r/packages-installed-in-user-libraries.md)
108109

109110
## Data exploration and modeling

docs/advanced-analytics/install/sql-ml-component-commandline-install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ manager: cgronlun
1414

1515
This article provides instructions for intalling SQL Server machine learning components from a command line:
1616

17-
+ [In-database instance](#indb)
17+
+ [New In-Database instance](#indb)
1818
+ [Add to an existing database engine instance](#add-existing)
1919
+ [Silent install](#silent)
20-
+ [Standalone server](#shared-feature)
20+
+ [New standalone server](#shared-feature)
2121

2222
You can specify silent, basic, or full interaction with the Setup user interface. This article supplements [Install SQL Server from the Command Prompt](../../database-engine/install-windows/install-sql-server-from-the-command-prompt.md), covering the parameters unique to R and Python machine learning components.
2323

docs/advanced-analytics/r/install-additional-r-packages-on-sql-server.md

Lines changed: 8 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ manager: cgronlun
1414
# Install new R packages on SQL Server
1515
[!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md-winonly](../../includes/appliesto-ss-xxxx-xxxx-xxx-md-winonly.md)]
1616

17-
This article describes how to install new R packages to an instance of SQL Server where machine learning is enabled. There are multiple methods for installing new R packages, depending on which version of SQL Server you have, and whether the server has an internet connection.
17+
This article describes how to install new R packages to an instance of SQL Server where machine learning is enabled. There are multiple methods for installing new R packages, depending on which version of SQL Server you have, and whether the server has an internet connection. The following approaches for new package installation are possible.
18+
19+
| Approach | Permissions | Remote/Local |
20+
|------------------------------------|---------------------------|-------|
21+
| [Use conventional R package managers](#bkmk_rInstall) | Admin | Local |
22+
| [Use RevoScaleR](use-revoscaler-to-manage-r-packages.md) | Admin | Local |
23+
| [Use T-SQL (CREATE EXTERNAL LIBRARY)](install-r-packages-tsql.md) | Admin to setup, database roles afterwards | both
24+
| [Use a miniCRAN to create a local repository](create-a-local-package-repository-using-minicran.md) | Admin to setup, database roles afterwards | both |
1825

1926
## <a name="bkmk_rInstall"></a> Install R packages over an Internet connection
2027

@@ -74,51 +81,6 @@ This procedure assumes that you have prepared all the packages that you need, in
7481

7582
If any required packages are not present in the instance library, and cannot be found in the zipped files, installation of the target package fails.
7683

77-
## <a name="bkmk_createlibrary"></a> Use CREATE EXTERNAL LIBRARY
78-
79-
**Applies to:** [!INCLUDE[sssql17-md](../../includes/sssql17-md.md)] [!INCLUDE[rsql-productnamenew-md](../../includes/rsql-productnamenew-md.md)]
80-
81-
The [CREATE EXTERNAL LIBRARY](https://docs.microsoft.com/sql/t-sql/statements/create-external-library-transact-sql) statement makes it possible to add a package or set of packages to an instance or a specific database without running R or Python code directly. However, this method requires package preparation and additional database permissions.
82-
83-
+ All packages must be be available as a local zipped file, rather than downloaded on demand from the internet.
84-
85-
If you do not have access to the file system on the server, you can also pass a complete package as a variable, using a binary format. For more information, see [CREATE EXTERNAL LIBRARY](../../t-sql/statements/create-external-library-transact-sql.md).
86-
87-
+ All dependencies must be identified by name and version, and included in the zip file. The statement fails if required packages are not available, including downstream package dependencies. We recommend using **miniCRAN** or **igraph** for analyzing packages dependencies. Installing the wrong version of package or package dependency can also cause the statement to fail.
88-
89-
+ You must have the necessary permissions on the database. For details, see [CREATE EXTERNAL LIBRARY](https://docs.microsoft.com/sql/t-sql/statements/create-external-library-transact-sql).
90-
91-
### Prepare the packages in archive format
92-
93-
1. If you are installing a single package, download the package in zipped format.
94-
95-
2. If the package requires any other packages, you must verify that the required packages are available. You can use miniCRAN to analyze the target package and identify all its dependencies.
96-
97-
3. Copy the zipped files or miniCRAN repository containing all packages to a local folder on the server.
98-
99-
4. Open a **Query** window, using an account with administrative privileges.
100-
101-
5. Run the T-SQL statement `CREATE EXTERNAL LIBRARY` to upload the zipped package collection to the database.
102-
103-
For example, the following statement names as the package source a miniCRAN repository containing the **randomForest** package, together with its dependencies.
104-
105-
```R
106-
CREATE EXTERNAL LIBRARY randomForest
107-
FROM (CONTENT = 'C:\Temp\Rpackages\randomForest_4.6-12.zip')
108-
WITH (LANGUAGE = 'R');
109-
```
110-
111-
You cannot use an arbitrary name; the external library name must have the same name that you expect to use when loading or calling the package.
112-
113-
6. If the library is successfully created, you can run the package in SQL Server, by calling it inside a stored procedure.
114-
115-
```SQL
116-
EXEC sp_execute_external_script
117-
@language =N'R',
118-
@script=N'
119-
library(randomForest)'
120-
```
121-
12284
## Tips for package installation
12385

12486
This section provides assorted tips and common questions related to R package installation on SQL Server.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Use T-SQL (CREATE EXTERNAL LIBRARY) to install R packages on SQL Server Machine Learning Services| Microsoft Docs
3+
description: Add new R packages to SQL Server 2017 Machine Learning Services (In-Database)
4+
ms.prod: sql
5+
ms.technology: machine-learning
6+
7+
ms.date: 05/20/2018
8+
ms.topic: conceptual
9+
author: HeidiSteen
10+
ms.author: heidist
11+
manager: cgronlun
12+
---
13+
14+
# Use T-SQL (CREATE EXTERNAL LIBRARY) to install R packages on SQL Server 2017 Machine Learning Services
15+
[!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md-winonly](../../includes/appliesto-ss-xxxx-xxxx-xxx-md-winonly.md)]
16+
17+
This article describes how to install new R packages to an instance of SQL Server where machine learning is enabled. There are multiple approaches to choose from. This approach works best for server administrators who are unfamiliar with R.
18+
19+
**Applies to:** [!INCLUDE[sssql17-md](../../includes/sssql17-md.md)] [!INCLUDE[rsql-productnamenew-md](../../includes/rsql-productnamenew-md.md)]
20+
21+
The [CREATE EXTERNAL LIBRARY](https://docs.microsoft.com/sql/t-sql/statements/create-external-library-transact-sql) statement makes it possible to add a package or set of packages to an instance or a specific database without running R or Python code directly. However, this method requires package preparation and additional database permissions.
22+
23+
+ All packages must be be available as a local zipped file, rather than downloaded on demand from the internet.
24+
25+
+ All dependencies must be identified by name and version, and included in the zip file. The statement fails if required packages are not available, including downstream package dependencies.
26+
27+
+ You must have the necessary permissions on the database. For details, see [CREATE EXTERNAL LIBRARY](https://docs.microsoft.com/sql/t-sql/statements/create-external-library-transact-sql).
28+
29+
## Download packages in archive format
30+
31+
If you are installing a single package, download the package in zipped format.
32+
33+
If the package requires any other packages, you must verify that the required packages are available. You can use miniCRAN to analyze the target package and identify all its dependencies. We recommend using [**miniCRAN**](create-a-local-package-repository-using-minicran.md) or [**igraph**](http://igraph.org/r/) for analyzing packages dependencies. Installing the wrong version of package or package dependency can also cause the statement to fail.
34+
35+
## Copy the file to a local folder
36+
37+
Copy the zipped file containing all packages to a local folder on the server. If you do not have access to the file system on the server, you can also pass a complete package as a variable, using a binary format. For more information, see [CREATE EXTERNAL LIBRARY](../../t-sql/statements/create-external-library-transact-sql.md).
38+
39+
## Run the statement to upload packages
40+
41+
Open a **Query** window, using an account with administrative privileges.
42+
43+
Run the T-SQL statement `CREATE EXTERNAL LIBRARY` to upload the zipped package collection to the database.
44+
45+
For example, the following statement names as the package source a miniCRAN repository containing the **randomForest** package, together with its dependencies.
46+
47+
```R
48+
CREATE EXTERNAL LIBRARY randomForest
49+
FROM (CONTENT = 'C:\Temp\Rpackages\randomForest_4.6-12.zip')
50+
WITH (LANGUAGE = 'R');
51+
```
52+
53+
You cannot use an arbitrary name; the external library name must have the same name that you expect to use when loading or calling the package.
54+
55+
## Verify package installation
56+
57+
If the library is successfully created, you can run the package in SQL Server, by calling it inside a stored procedure.
58+
59+
```SQL
60+
EXEC sp_execute_external_script
61+
@language =N'R',
62+
@script=N'
63+
library(randomForest)'
64+
```
65+

docs/advanced-analytics/r/use-sqlbindr-exe-to-upgrade-an-instance-of-sql-server.md

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -257,37 +257,6 @@ Alternatively, this is more work, but you could also fully uninstall and reinsta
257257
258258
You might have added other open-source or third-party packages to your package library. Since reversing the binding switches the location of the default package library, you must reinstall the packages to the library that R and Python are now using. For more information, see [Default packages](installing-and-managing-r-packages.md), [Install new R packages](install-additional-r-packages-on-sql-server.md), and [Install new Python packages](../python/install-additional-python-packages-on-sql-server.md).
259259
260-
## Known issues
261-
262-
This section lists known issues specific to use of the SqlBindR.exe utility, or to upgrades of Machine Learning Server that might affect SQL Server instances.
263-
264-
### Restoring packages that were previously installed
265-
266-
If you upgraded to Microsoft R Server 9.0.1, the version of SqlBindR.exe for that version failed to restore the original packages or R components completely, requiring that the user run SQL Server repair on the instance, apply all service releases, and then restart the instance.
267-
268-
Later version of SqlBindR automatically restore the original R features, eliminating the need for reinstallation of R components or re-patch the server. However, you must install any R package updates that might have been added after the initial installation.
269-
270-
If you have used the package management roles to install and share package, this task is much easier: you can use R commands to synchronize installed packages to the file system using records in the database, and vice versa. For more information, see [R package management for SQL Server](r-package-management-for-sql-server-r-services.md).
271-
272-
### Problems with multiple upgrades from SQL Server
273-
274-
If you have previously upgraded an instance of SQL Server 2016 R Services to 9.0.1, when you run the new installer for Microsoft R Server 9.1.0, it displays a list of all valid instances, and then by default selects previously bound instances. If you continue, the previously bound instances are unbound. As a result, the earlier 9.0.1 installation is removed, including any related packages, but the new version of Microsoft R Server (9.1.0) is not installed.
275-
276-
As a workaround, you can modify the existing R Server installation as follows:
277-
1. In Control Panel, open **Add or Remove Programs**.
278-
2. Locate Microsoft R Server, and click **Change/Modify**.
279-
3. When the installer starts, select the instances you want to bind to 9.1.0.
280-
281-
Microsoft Machine Learning Server 9.2.1 and 9.3 do not have this issue.
282-
283-
### Binding or unbinding leaves multiple temporary folders
284-
285-
Sometimes the binding and unbinding operations fail to clean up temporary folders.
286-
If you find folders with a name like this, you can remove it after installation is complete: R_SERVICES_<guid>
287-
288-
> [!NOTE]
289-
> Be sure to wait until installation is complete. It can take a long time to remove R libraries associated with one version and then add the new R libraries. When the operation completes, temporary folders are removed.
290-
291260
## SqlBindR.exe command syntax
292261
293262
### Usage
@@ -321,6 +290,36 @@ MLS Installer and SqlBindR both return the following error codes and messages.
321290
|Bind error 8 | Unbind failed | An error occurred while unbinding the instance. |
322291
|Bind error 9 | No instances found | No database engine instances were found on this computer. |
323292
293+
## Known issues
294+
295+
This section lists known issues specific to use of the SqlBindR.exe utility, or to upgrades of Machine Learning Server that might affect SQL Server instances.
296+
297+
### Restoring packages that were previously installed
298+
299+
If you upgraded to Microsoft R Server 9.0.1, the version of SqlBindR.exe for that version failed to restore the original packages or R components completely, requiring that the user run SQL Server repair on the instance, apply all service releases, and then restart the instance.
300+
301+
Later version of SqlBindR automatically restore the original R features, eliminating the need for reinstallation of R components or re-patch the server. However, you must install any R package updates that might have been added after the initial installation.
302+
303+
If you have used the package management roles to install and share package, this task is much easier: you can use R commands to synchronize installed packages to the file system using records in the database, and vice versa. For more information, see [R package management for SQL Server](r-package-management-for-sql-server-r-services.md).
304+
305+
### Problems with multiple upgrades from SQL Server
306+
307+
If you have previously upgraded an instance of SQL Server 2016 R Services to 9.0.1, when you run the new installer for Microsoft R Server 9.1.0, it displays a list of all valid instances, and then by default selects previously bound instances. If you continue, the previously bound instances are unbound. As a result, the earlier 9.0.1 installation is removed, including any related packages, but the new version of Microsoft R Server (9.1.0) is not installed.
308+
309+
As a workaround, you can modify the existing R Server installation as follows:
310+
1. In Control Panel, open **Add or Remove Programs**.
311+
2. Locate Microsoft R Server, and click **Change/Modify**.
312+
3. When the installer starts, select the instances you want to bind to 9.1.0.
313+
314+
Microsoft Machine Learning Server 9.2.1 and 9.3 do not have this issue.
315+
316+
### Binding or unbinding leaves multiple temporary folders
317+
318+
Sometimes the binding and unbinding operations fail to clean up temporary folders.
319+
If you find folders with a name like this, you can remove it after installation is complete: R_SERVICES_<guid>
320+
321+
> [!NOTE]
322+
> Be sure to wait until installation is complete. It can take a long time to remove R libraries associated with one version and then add the new R libraries. When the operation completes, temporary folders are removed.
324323
325324
## See also
326325

0 commit comments

Comments
 (0)