Skip to content

Commit 3ce8a8b

Browse files
committed
Edits to package management topics and test of scenarios
1 parent 2badebe commit 3ce8a8b

8 files changed

Lines changed: 515 additions & 481 deletions

docs/advanced-analytics/r/create-a-local-package-repository-using-minicran.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Create a local package repository using miniCRAN | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "01/04/2018"
4+
ms.date: "02/20/2018"
55
ms.reviewer:
66
ms.suite: sql
77
ms.prod: machine-learning-services
@@ -21,47 +21,50 @@ ms.workload: "Inactive"
2121
# Create a local package repository using miniCRAN
2222
[!INCLUDE[appliesto-ss-xxxx-xxxx-xxx-md-winonly](../../includes/appliesto-ss-xxxx-xxxx-xxx-md-winonly.md)]
2323

24-
There are two ways that you can prepare R packages for installation onto a server without internet access.
24+
The [miniCRAN](https://cran.r-project.org/web/packages/miniCRAN/index.html) package was created by Andre de Vries to support these common scenarios:
2525

26-
- [Use the miniCRAN package to create a single local repository](#bkmk_miniCRAN)
26+
+ Analyzing package dependencies for a single package or set of packages
27+
+ Preparing a set of R packages for installation onto a server without internet access.
2728

28-
The [miniCRAN](https://cran.r-project.org/web/packages/miniCRAN/index.html) creates an internally consistent repository consisting of selected packages from CRAN-like repositories. The user specifies a set of desired packages, and miniCRAN recursively reads the dependency tree for these packages, and downloads only the listed packages and their dependencies.
29+
The user specifies a set of desired packages, and miniCRAN recursively reads the dependency tree for these packages, and downloads only the listed packages and their dependencies from CRAN or similar repositories.
2930

30-
You can then move this local repository to the server, and proceed to install the packages without using the internet.
31+
As an output, miniCRAN creates an internally consistent repository consisting of the selected packages and all required dependencies. You can then move this local repository to the server, and proceed to install the packages without using the internet.
3132

32-
- [Manually download and copy packages one by one](#bkmk_manual)
33+
Experienced R users often look for the list of dependent packages in the DESCRIPTION file for the downloaded package. However, packages listed in **Imports** might have second-level dependencies. For this reason, we recommend use of the **miniCRAN** method.
3334

34-
You can find the list of dependent packages in the DESCRIPTION file for the downloaded package.
35-
36-
However, packages listed in **Imports** might have second-level dependencies. For this reason, we recommend use of the **miniCRAN** method.
37-
38-
> [!TIP]
39-
> Did you know that you can use miniCRAN to prepare packages for use in Azure Machine Learning? For more information, see this blog: [Using miniCRAN in Azure ML, by Michele Usuelli](https://www.r-bloggers.com/using-minicran-in-azure-ml/)
4035

41-
## Prepare packages using miniCRAN
36+
## What is a package repository
4237

43-
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.
38+
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. After creating the repository, you can modify it by adding new packages or upgrading the version of existing packages.
4439

4540
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.
4641

47-
There are many advantages to using miniCRAN to create the repository:
42+
Package repositories are useful in these scenarios:
4843

4944
- **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.
5045

5146
- **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.
5247

5348
- **Improved version management**: In a multiuser environment, there are good reasons to avoid unrestricted installation of multiple package versions on the server.
5449

55-
After creating the repository, you can modify it by adding new packages or upgrading the version of existing packages.
50+
By using miniCRAN, you can avoid package dependency errors when using the CREATE EXTERNAL LIBRARY statement.
51+
52+
You can also use miniCRAN to prepare packages for use in Azure Machine Learning. For more information, see this blog: [Using miniCRAN in Azure ML, by Michele Usuelli](https://www.r-bloggers.com/using-minicran-in-azure-ml/)
53+
54+
55+
## Prepare packages using miniCRAN
56+
57+
The **miniCRAN** package itself is dependent on 18 other CRAN packages, among which is the **RCurl** package, which has a system dependency on the **curl-devel** package. Similarly, package **XML** has a dependency on **libxml2-devel**.
58+
59+
For these reasons, we recommend that you build your local repository initially on a machine with full Internet access, so that you can easily satisfy all these dependencies.
5660

57-
> [!NOTE]
58-
> The miniCRAN package itself is dependent on 18 other CRAN packages, among which is the RCurl package, which has a system dependency on the curl-devel package. Similarly, package XML has a dependency on libxml2-devel. We recommend, therefore, that you build your local repository initially on a machine with full Internet access, so that you can easily satisfy all these dependencies. After created, you can move the repository to a different location.
61+
After the repository has been created, you can move the repository to a different location.
5962

6063
### Step 1. Install the miniCRAN package
6164

62-
You begin by creating a miniCRAN repository to use as a source. You should create this repository on a computer that has internet access.
65+
You begin by creating a **miniCRAN** repository to use as a source. You should create this repository on a computer that has internet access.
6366

64-
1. Install the miniCRAN package and the required **igraph** package.
67+
1. Install the **miniCRAN** package and the required **igraph** package.
6568

6669
```R
6770
if(!require("miniCRAN")) install.packages("miniCRAN") if(!require("igraph"))
@@ -73,7 +76,7 @@ You begin by creating a miniCRAN repository to use as a source. You should creat
7376
1. Specify a mirror site to use in getting packages.
7477

7578
```R
76-
CRAN_mirror \<- c(CRAN = "https://mran.microsoft.com/snapshot/2017-08-01")
79+
CRAN_mirror <- c(CRAN = "https://mran.microsoft.com/snapshot/2017-08-01")
7780
```
7881

7982
2. Type the name of a local folder in which to store the collected packages.
@@ -90,13 +93,13 @@ You begin by creating a miniCRAN repository to use as a source. You should creat
9093

9194
### Step 3. Add packages to the repository
9295

93-
1. After miniCRAN is installed, create a list that specifies the additional packages you want to download.
96+
1. After **miniCRAN** is installed, create a list that specifies the additional packages you want to download.
9497

95-
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 the generated dependency graph, see [Using miniCRAN to identify package
98+
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 the generated dependency graph, see [Using miniCRAN to identify package
9699
dependencies](https://cran.r-project.org/web/packages/miniCRAN/vignettes/miniCRAN-dependency-graph.html).
97100

98-
The following R script demonstrates how to get the target packages, "zoo"
99-
and "forecast".
101+
The following R script adds the target packages, "zoo"
102+
and "forecast" to a variable.
100103

101104
```R
102105
pkgs_needed <- c("zoo", "forecast")
@@ -135,7 +138,7 @@ Depending on the version of SQL Server, there are two options for adding new pac
135138

136139
- Install to the instance library using the miniCRAN repository and R tools.
137140

138-
- Upload packages to a SQL Server database and install using the CREATE EXTERNAL LIBRARY statement. This option requires SQL Server 2017. See [Install additional R packages on SQL Server](install-additional-r-packages-on-sql-server.md).
141+
- Upload packages to a location on the SQL Server computer, and install using the CREATE EXTERNAL LIBRARY statement. This option requires SQL Server 2017.
139142

140143
The following procedure describes how to install the packages using R tools.
141144

@@ -160,7 +163,7 @@ The following procedure describes how to install the packages using R tools.
160163

161164
On SQL Server, this command should return the path of the library associated with the instance, such as: "C:/Program Files/Microsoft SQL Server/MSSQL14.MSSQLSERVER/R_SERVICES/library "
162165

163-
4. Specify the location on the server where you copied the mininCRAN repository in `server_repo`.
166+
4. Specify the location on the server where you copied the **miniCRAN** repository in `server_repo`.
164167

165168
In this example, we assume that you copied the repository to your user folder on the server.
166169

@@ -187,21 +190,18 @@ The following procedure describes how to install the packages using R tools.
187190
```
188191

189192
> [!NOTE]
190-
> In SQL Server, a server administrator must install packages from the miniCRAN repository into the default library used by the instance.
193+
> To use the package in SQL Server, the packages must be installed into the default library used by the instance.
191194

192-
## Manually download single packages
195+
## Manually install a single package from a zipped file
193196

194-
If you do not want to use miniCRAN, you can also manually download the packages you need, and their dependencies. To do this requires that you are either an administrator or sole owner of a server.
197+
If you are installing a single package that has no dependencies, or you cannot use **miniCRAN**, you can also manually download the package you need. To do this requires that you are either an administrator or sole owner of a server.
195198

196199
After downloading the packages, you install the R packages from the zipped file location.
197200

198-
1. Download the packages zip files, and save them in a local folder
201+
1. Download the package as a zipped file, and save it in a local folder
199202

200203
2. Copy that folder to the [!INCLUDE[ssNoVersion_md](..\..\includes\ssnoversion-md.md)] computer.
201204

202-
3. Install the packages into the SQL Server instance library.
205+
3. Install the packages into the SQL Server instance library using conventional R commands. If the package has dependencies that are not already installed, and you have not included them, installation might fail.
203206

204-
> [!NOTE]
205-
> When you use R tools to install packages, they are installed for the instance as a whole.
206-
>
207-
> If you want to install the package into a database and share the package with users using database roles, you must upload the library using the CREATE EXTERNAL LIBRARY statement. See [Install additional R packages in SQL Server](install-additional-r-packages-on-sql-server.md)
207+
You can also upload individual packages into an instance of SQL Server 2017, by using the CREATE EXTERNAL LIBRARY statement. This feature requires some additional steps to prepare the server. For example, a script must be run to create database roles on the instance and on specific databases. If the package library is successfully created, you must then install the package into the R environment by calling install.packages from sp_execute_external_script. For more information, see these resources:

0 commit comments

Comments
 (0)