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
Copy file name to clipboardExpand all lines: docs/advanced-analytics/r/create-a-local-package-repository-using-minicran.md
+8-13Lines changed: 8 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,29 +27,24 @@ There are two ways that you can prepare R packages for installation onto a serve
27
27
28
28
-[Manually download and copy packages one by one](#bkmk_manual)
29
29
30
-
This article describes how you can create an R package repository using both methods, with particualr emphasis on the **miniCRAN** package.
30
+
This article describes how you can create an R package repository using both methods, and recommends use of the **miniCRAN** package.
31
31
32
32
## Prepare packages using miniCRAN
33
33
34
34
The goal of creating a local package repository is to provide a single location that a server administrator or other users in the organization can use to install new R packages on a server that does not have internet access.
35
35
36
-
The miniCRAN package for R was written by Andre de Vries to make it easier to create a consistent, managed set of R packages for an organization.
37
-
38
-
After creating the repository, you can modify it by adding new packages or upgrading the version of existing packages.
39
-
40
-
- For details, see [miniCRAN](https://cran.r-project.org/web/packages/miniCRAN/index.html)
41
-
42
-
- For a walkthrough of the repository creation process, see [How to install R packages on an off-line SQL Server 2016 instance](http://blog.revolutionanalytics.com/2016/05/minicran-sql-server.html)
43
-
36
+
The [miniCRAN](https://cran.r-project.org/web/packages/miniCRAN/index.html) package for R was written by [Andre de Vries](http://blog.revolutionanalytics.com/2016/05/minicran-sql-server.html) to make it easier to create a consistent, managed set of R packages for an organization.
44
37
45
38
There are many advantages to using miniCRAN to create the repository:
46
39
47
-
-**Security**: Many R users are accustomed to downloading and installing new R packages at will, from CRAN or one of its mirror sites. However, for security reasons, production servers running [!INCLUDE[ssNoVersion_md](file:///C:\includes\ssnoversion-md.md)] typically do not have internet connectivity.
40
+
-**Security**: Many R users are accustomed to downloading and installing new R packages at will, from CRAN or one of its mirror sites. However, for security reasons, production servers running [!INCLUDE[ssNoVersion_md](..\..\includes\ssnoversion-md.md)] typically do not have internet connectivity.
48
41
49
42
-**Easier offline installation**: To install package to an offline server requires that you also download all package dependencies, Using miniCRAN makes it easier to get all dependencies in the correct format.
50
43
51
44
-**Improved version management**: In a multiuser environment, there are good reasons to avoid unrestricted installation of multiple package versions on the server.
52
45
46
+
After creating the repository, you can modify it by adding new packages or upgrading the version of existing packages.
47
+
53
48
### Step 1. Install the miniCRAN package
54
49
55
50
You begin by creating a miniCRAN repository to use as a source. You should create this repository on a computer that has internet access.
@@ -83,7 +78,7 @@ You begin by creating a miniCRAN repository to use as a source. You should creat
83
78
84
79
1. After miniCRAN is installed, create a list that specifies the additional packages you want to download.
85
80
86
-
Do not include dependencies; the **igraph** package used by miniCRAN generates the list of dependencies for you. For more information about how to use this graph, see [Using miniCRAN to identify package
81
+
Do not add dependencies to this initial list; the **igraph** package used by miniCRAN generates the list of dependencies for you. For more information about how to use this graph, see [Using miniCRAN to identify package
From this information, the miniCRAN package creates the folder structure that you need to copy the packages to the [!INCLUDE[ssNoVersion_md](file:///C:\includes\ssnoversion-md.md)] later.
103
+
From this information, the miniCRAN package creates the folder structure that you need to copy the packages to the [!INCLUDE[ssNoVersion_md](..\..\includes\ssnoversion-md.md)] later.
109
104
110
105
4. At this point you should have a folder containing the packages you needed, and any additional packages that were required.
111
106
@@ -192,7 +187,7 @@ After downloading the packages, you install the R packages from the zipped file
Copy file name to clipboardExpand all lines: docs/advanced-analytics/r/determine-which-packages-are-installed-on-sql-server.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,14 +17,13 @@ manager: "jhubbard"
17
17
---
18
18
# Determine which R packages are installed on SQL Server
19
19
20
-
When you install Machine Learning Services with the R language option, or install
21
-
[!INCLUDE[rsql_productname](file:///C:\includes\rsql-productname-md.md)], setup creates an R package library associated with the instance. Each instance has a separate package library. Package libraries are **not** shared across instances, so it is possible for different packages to be installed on different instances.
20
+
When you install machine learning in SQL Server with the R language option, setup creates an R package library associated with the instance. Each instance has a separate package library. Package libraries are **not** shared across instances, so it is possible for different packages to be installed on different instances.
22
21
23
-
This article describes how you can determine which R packages are installed for a specific the [!INCLUDE[ssNoVersion](file:///C:\includes\ssnoversion-md.md)]instance.
22
+
This article describes how you can determine which R packages are installed for a specific instance.
24
23
25
24
## Generate R package list using a stored procedure
26
25
27
-
The following example uses the base R function `installed.packages()` in a [!INCLUDE[tsql](file:///C:\includes\tsql-md.md)] stored procedure to get a matrix of packages that have been installed in the R_SERVICES library for the current instance. To avoid parsing the fields in the DESCRIPTION file, only the name is returned.
26
+
The following example uses the R function `installed.packages()` in a [!INCLUDE[tsql](..\..\includes\tsql-md.md)] stored procedure to get a matrix of packages that have been installed in the R_SERVICES library for the current instance. To avoid parsing the fields in the DESCRIPTION file, only the name is returned.
28
27
29
28
```SQL
30
29
EXECUTE sp_execute_external_script
@@ -52,7 +51,7 @@ GO
52
51
53
52
This example looks for and loads the RevoScaleR library.
54
53
55
-
+ If the package is found, the message returned should be something like "Commands completed successfully".
54
+
+ If the package is found, the message returned should be something like "Commands completed successfully."
56
55
57
56
+ If the package cannot be located or loaded, you get an error like this: "An external script error occurred: Error in library("RevoScaleR"): there is no package called RevoScaleR"
Copy file name to clipboardExpand all lines: docs/advanced-analytics/r/install-additional-r-packages-on-sql-server.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,10 +30,11 @@ The process differs slightly depending on the version of SQL Server you are runn
30
30
31
31
See [Getting the correct package version and format](#packageVersion) for details.
32
32
33
-
2. If the server does not have internet access, you'll need to download the binaries in zipped format in advance.
33
+
2. If the server does not have internet access, download the binaries in advance.
34
+
34
35
See [Download zip files](#bkmk_zipPreparation) for details.
35
36
36
-
3. If installing offline, check for package dependencies and get any related packages that might be needed during installation. Using the [miniCRAN package](#bkmk_packageDependencies) is an easy way to prepare a collection of packages and their dependeicnies.
37
+
3. If installing offline, check for package dependencies and get any related packages that might be needed during installation. Using the [miniCRAN package](#bkmk_packageDependencies) is an easy way to prepare a collection of packages and their dependencies.
37
38
38
39
4. Package installation methods differ depending on whether the server has internet access, and on your version of SQL Server. The recommended methods are as follows:
39
40
@@ -59,7 +60,7 @@ The process differs slightly depending on the version of SQL Server you are runn
59
60
60
61
There are multiple sources for R packages, the best known among them being CRAN and Bioconductor. The official site for the R language (<https://www.r-project.org/>) lists many of these resources. Many packages are also published to GitHub, where you can obtain the source code. However, you may also have been given R packages that were developed by someone in your company.
61
62
62
-
Regardless of the source, you must ensure that the package you want to install has a binary format for the Windows platform. Otherwise the downloaded package will not run in the SLQ Server environment.
63
+
Regardless of the source, you must ensure that the package you want to install has a binary format for the Windows platform. Otherwise the downloaded package cannot run in the SQL Server environment.
63
64
64
65
You should also determine whether the package is compatible with the version of R that is running in SQL Server.
65
66
@@ -91,7 +92,7 @@ If you need to install multiple packages, or want to ensure that everyone in you
91
92
92
93
If you are an experienced R user, you might be accustomed to installing packages from the command line without special permissions, or without downloading them in advance. However, most servers do not have an internet connection and access to file shares or storage might be restricted.
93
94
94
-
This section describes the different level of permissions required for installing pckages in SQL Server 2016 and SQl Server 2017. Installation can be done using either R tools or SQL Server, but the process and permissions differ slightly.
95
+
This section describes the different level of permissions required for installing packages in SQL Server 2016 and SQl Server 2017. Installation can be done using either R tools or SQL Server, but the process and permissions differ slightly.
95
96
96
97
- SQL Server 2016
97
98
@@ -107,7 +108,7 @@ This section describes the different level of permissions required for installin
107
108
108
109
> [!IMPORTANT]
109
110
>
110
-
> Experienced R users are accustomed to installing packages in a user library, and then referencing the package in that folder as part of the R solution, by specifying a file path. This practice will not work in SQL Server. For more information and workarounds, see [How to use packages in user libraries](packages-installed-in-user-libraries.md).
111
+
> Experienced R users are accustomed to installing packages in a user library, and then referencing the package in that folder as part of the R solution, by specifying a file path. This practice is not supported in SQL Server. For more information and workarounds, see [How to use packages in user libraries](packages-installed-in-user-libraries.md).
Copy file name to clipboardExpand all lines: docs/advanced-analytics/r/installing-and-managing-r-packages.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,29 +63,29 @@ Installation of R in SQL Server 2016 and SQL Server 2017 also includes the **Rev
63
63
64
64
## Permissions required for installing R packages
65
65
66
-
In SQL Server 2016, an administrator had to istall new R packages on an instance-wide basis. In SQL Server 2017, new database features were added that give the database administrator the ability to delegate package management to selected users.
66
+
In SQL Server 2016, an administrator had to install new R packages on an instance-wide basis. In SQL Server 2017, new database features were added that give the database administrator the ability to delegate package management to selected users.
67
67
68
68
This section describes the permissions required to install and manage packages per version.
69
69
70
70
+ SQL Server 2016 R Services (In-Database)
71
71
72
-
To install a new R package on a computer that is running [!INCLUDE[ssCurrent](file:///C:\includes\sscurrent-md.md)], you must have administrative rights to the computer. It is the task of the database administrator or other administrator on the server to ensure that all required packages are installed on the [!INCLUDE[ssNoVersion_md](file:///C:\includes\ssnoversion-md.md)] instance.
72
+
To install a new R package on a computer that is running [!INCLUDE[ssCurrent](..\..\includes\sscurrent-md.md)], you must have administrative rights to the computer. It is the task of the database administrator or other administrator on the server to ensure that all required packages are installed on the [!INCLUDE[ssNoVersion_md](..\..\includes\ssnoversion-md.md)] instance.
73
73
74
-
If you do not have administrative privileges on the computer that hosts the [!INCLUDE[ssNoVersion_md](file:///C:\includes\ssnoversion-md.md)] instance, you can provide to the administrator information about how to install R packages, and provide access to a secure package repository where packages requested by users can be obtained.
74
+
If you do not have administrative privileges on the computer that hosts the [!INCLUDE[ssNoVersion_md](..\..\includes\ssnoversion-md.md)] instance, you can provide to the administrator information about how to install R packages, and provide access to a secure package repository where packages requested by users can be obtained.
75
75
76
76
+ SQL Server 2017 Machine Learning Services
77
77
78
-
This release includes package management functions that let database administrator delegate package installation rights to selected users. If this feature has been enabled, request that your database administrator add you to one of the new pakcage roles. For more information, see [R package management for SQL Server](r-package-management-for-sql-server-r-services.md).
78
+
This release includes package management functions that let database administrator delegate package installation rights to selected users. If this feature has been enabled, request that your database administrator add you to one of the new package roles. For more information, see [R package management for SQL Server](r-package-management-for-sql-server-r-services.md).
79
79
80
-
If you are an administrator on the SQL Server instance, you can install new packages at will. Just be sure to use the default library that is associated with the instance, or the package might not run when called from a stored procedure, or as part of a remote SQL Server compute context.
80
+
If you are an administrator on the SQL Server instance, you can install new packages at will. Just be sure to use the default library that is associated with the instance. Packages installed to other locations cannot run when called from a stored procedure. Any R code that runs using the SQL Server as a compute context also requires that packages be available in the instance library.
81
81
82
82
+ R Server (Standalone)
83
83
84
84
You need administrative rights to the computer to install new R packages.
85
85
86
86
+ Other client environments
87
87
88
-
If you are installing a new R package on a computer that is being used as an R workstation and the computer does **not** have an instance of [!INCLUDE[ssNoVersion_md](file:///C:\includes\ssnoversion-md.md)] installed, you still need administrative rights to the computer to install the package. After you have installed the package, you can run it locally.
88
+
If you are installing a new R package on a computer that is being used as an R workstation and the computer does **not** have an instance of [!INCLUDE[ssNoVersion_md](..\..\includes\ssnoversion-md.md)] installed, you still need administrative rights to the computer to install the package. After you have installed the package, you can run it locally.
Copy file name to clipboardExpand all lines: docs/advanced-analytics/r/package-install-uninstall-and-sync.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ Before you can use package synchronization, you must have the appropriate versio
46
46
47
47
This feature is available in SQL Server 2017 CTP 2 or later.
48
48
49
-
Because this feature uses R functions in Microsoft R version 9.1.0, you can add this feature to a instance of SQL Server 2016 by upgrading the instance to use the latest version of Microsoft R. For more information, see [Use SqlBindR.exe to Upgrade SQL Server R Services](use-sqlbindr-exe-to-upgrade-an-instance-of-sql-server.md).
49
+
Because this feature uses R functions in Microsoft R version 9.1.0, you can add this feature to an instance of SQL Server 2016 by upgrading the instance to use the latest version of Microsoft R. For more information, see [Use SqlBindR.exe to Upgrade SQL Server R Services](use-sqlbindr-exe-to-upgrade-an-instance-of-sql-server.md).
50
50
51
51
### Enable the package management feature
52
52
@@ -63,7 +63,7 @@ Whenever you add a new package using the package management functions, both the
63
63
> You cannot use package synchronization if you have been installing R packages the traditional way, using R tools to install packages directly into the file system.
64
64
### Permissions
65
65
66
-
+ The person who executes the package snchronization function must be a security principal on the SQL
66
+
+ The person who executes the package synchronization function must be a security principal on the SQL
67
67
Server instance and database that has the packages.
68
68
69
69
+ The caller of the function must be a member of one of these package management roles: **rpkgs-shared** or **rpkgs-private**.
Copy file name to clipboardExpand all lines: docs/advanced-analytics/r/packages-installed-in-user-libraries.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,25 +17,25 @@ manager: "jhubbard"
17
17
---
18
18
# Avoiding errors on R packages installed in user libraries
19
19
20
-
Experienced R users are accustomed to installing R packages in a user library, if the default library is blocked or not available. However, this approach is not supported in SQL Server, and installation to a user library usually ends in a “package not found” error.
20
+
Experienced R users are accustomed to installing R packages in a user library, whenever the default library is blocked or not available. However, this approach is not supported in SQL Server, and installation to a user library usually ends in a “package not found” error.
21
21
22
22
This topic provides workarounds to help you avoid this error. It explains how you can modify your R code, and suggests the correct R package installation process for using R packages from a SQL Server instance.
23
23
24
24
## Why R user libraries cannot be accessed from SQL Server
25
25
26
-
R developers who need to install new R packages are accustomed to installing packages at will, and using a private, user library whenever the default library is not available, or if the developer is not an administrator on the computer.
26
+
R developers who need to install new R packages are accustomed to installing packages at will, and using a private, user library whenever the default library is not available, or when the developer is not an administrator on the computer.
27
27
28
28
For example, in a typical R development environment, the user would add the location of the package to the R environment variable `libPath`, or reference the full package path, like this:
However, this can never work when running R solutions in SQL Server, because R packages must be installed to a specific default library that is associated with the instance.
34
+
However, this can never work when running R solutions in SQL Server, because R packages must be installed to a specific default library that is associated with the instance.
35
35
36
36
If the package is not installed in the default library, you might get this error when you try to call the package:
37
37
38
-
*Error in library(xxx) : there is no package called 'xxx'*
38
+
*Error in library(xxx) : there is no package called 'package-name'*
39
39
40
40
It is also a bad development practice to install required R packages to a custom user library, as it can lead to errors if a solution is run by another user who does not have access to the library location.
0 commit comments