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
The Machine Learning Services component of SQL Server adds in-database predictive analytics, statistical analysis, visualization, and machine learning algorithms. Function libraries are available in R and Python and run as external script on a database engine instance.
15
+
Starting in SQL Server 2017, R and Python support for in-database analytics is provided in SQL Server Machine Learning Services, the successor to R Services feature introduced in SQL Server 2016. Function libraries are available in R and Python and run as external script on a database engine instance.
16
16
17
17
This article explains how to install the machine learning component by running the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] setup wizard, and following the on-screen prompts.
+ SQL Server 2017 setup is required if you want to install Machine Learning Services with language support for R, Python, or both. If instead you have SQL Server 2016 installation media, you can install [SQL Server 2016 R Services (In-Database)](sql-r-services-windows-install.md) to get R language support.
21
+
+ SQL Server 2017 Setup is required if you want to install Machine Learning Services with language support for R, Python, or both. If instead you have SQL Server 2016 installation media, you can install [SQL Server 2016 R Services (In-Database)](sql-r-services-windows-install.md) to get R language support.
22
22
23
23
+ A database engine instance is required. You cannot install just R or Python features, although you can add them incrementally to an existing instance.
title: Set up a data-science client for R development on SQL Server | Microsoft Docs
2
+
title: Set up a datascience client for R development on SQL Server | Microsoft Docs
3
3
ms.prod: sql
4
4
ms.technology: machine-learning
5
5
@@ -16,93 +16,65 @@ After you have configured an instance of [!INCLUDE[ssCurrent](../../includes/ssc
16
16
17
17
This article describes some typical client scenarios, including configuration of the free Visual Studio Community edition to run R code in SQL Server.
18
18
19
-
## Install R libraries on the client
19
+
## 1 - Install R libraries
20
20
21
-
Your client environment must include Microsoft R Open, as well as the additional RevoScaleR packages that support distributed execution of R on SQL Server. Standard distributions of R do not have the packages that support remote compute contexts or parallel execution of R tasks.
21
+
Your client environment must include Microsoft R Open, as well as RevoScaleR and other product-specific R packages that support distributed execution of R on SQL Server. Standard distributions of R do not have the packages that support remote compute contexts or parallel execution of R tasks.
22
22
23
-
To get these libraries, install any of the following:
24
-
25
-
+[Microsoft R Client](http://aka.ms/rclient/download)
23
+
To get the full complement of libraries, install any of the following, but choose an option that most closely matches your SQL Server installation. Your client libraries should closely match equivalent libraries on the server.
|[SQL Server 2017 Machine Learning Server (Standalone)](../install/sql-machine-learning-standalone-windows-install.md)| For best compatibility with a SQL Server 2017 instance, install the free developer edition of SQL Server 2017, choosing the "Standalone server" feature under **Shared features** in SQL Server Setup. |
28
+
|[SQL Server 2016 R Server (Standalone)](../install/sql-r-standalone-windows-install.md)| Recommended for use with SQL Server 2016 R Services. Install the free developer edition of SQL Server 2016, choosing the "Standalone R Server" feature under **Shared features** in SQL Server Setup. |
29
+
|[Microsoft R Client](http://aka.ms/rclient/download)| This free download is a limited version of R Server: it provides RevoScaleR and other R packages, but is capped at two threads and in-memory data. However, by installing R Client, you can create R solutions that start locally, and shift execution (referred to as *compute context*) to access data and the computational power of a remote SQL Server instance. For more information, see [What is Microsoft R Client](https://docs.microsoft.com/machine-learning-server/r-client/what-is-microsoft-r-client). |
28
30
29
-
- To install from SQL Server setup, see [Install SQL Server 2016 R Server (Standalone)](../install/sql-r-standalone-windows-install.md)
31
+
## 2 - Use built-in R tools
30
32
31
-
- To use the separate Windows-based installer, see [Install Machine Learning Server for Windows](https://docs.microsoft.com/machine-learning-server/install/machine-learning-server-windows-install)
33
+
When you install R with SQL Server, you get the same R tools that are installed with any base installation of R, such as RGui, Rterm, and so forth. These tools are lightweight, useful for checking package and library information, running ad hoc commands or script, or stepping through tutorials.
32
34
33
-
+ Machine Learning Server (for SQL Server 2017)
35
+
Base R in Microsoft products is provided by Microsoft R Open, included in SQL Server Setup, built on open-source R. The following standard R tools are therefore installed by default.
34
36
35
-
- To install from SQL Server setup, see [Install SQL Server 2017 Machine Learning Server (Standalone)](../install/sql-machine-learning-standalone-windows-install.md)
37
+
| Tool | Description |
38
+
|------|-------------|
39
+
|**RTerm**: | A command-line terminal for running R scripts |
40
+
|**RGui.exe**| A simple interactive editor for R. The command-line arguments are the same for RGui.exe and RTerm. |
41
+
|**RScript**| A command-line tool for running R scripts in batch mode. |
36
42
37
-
- To use the separate Windows-based installer, see [Install R Server 9.1 for Windows](https://docs.microsoft.com/machine-learning-server/install/r-server-install-windows)
43
+
Tools are located in **bin** folder for base R as installed SQL Server or R Client. The following paths are valid locations for the tools, depending on which product version and feature you installed:
38
44
39
-
## R tools
45
+
+ R Client: `~\Program Files\Microsoft\R Client\R_SERVER\bin\x64`
46
+
+ R Services: `~\Program Files\Microsoft SQL Server\MSSQL13.<instancename>\R_SERVICES\bin\x64`
47
+
+ R Server Standalone: `~\Program Files\Microsoft SQL Server\130\R_SERVER\bin\x64`
+ Machine Learning Server (Standalone): `~\Program Files\Microsoft SQL Server\140\R_SERVER\bin\x64`
40
50
41
-
When you install R with SQL Server, you get the same R tools that are installed with any **base** installation of R, such as RGui, Rterm, and so forth. Therefore technically, you have all the tools you need to develop and test R code.
51
+
## 3 - Install an IDE
42
52
43
-
The following standard R tools are included in a *base installation* of R, and therefore are installed by default.
53
+
For sustained and serious development projects, you should install an integrated development environment (IDE).
44
54
45
-
+**RTerm**: A command-line terminal for running R scripts
55
+
### RStudio
46
56
47
-
+**RGui.exe**: A simple interactive editor for R. The command-line arguments are the same for RGui.exe and RTerm.
57
+
When using [RStudio](https://www.rstudio.com/), you can configure the environment to use the R libraries and executables that correspond to those on a remote SQL Server.
48
58
49
-
+**RScript**: A command-line tool for running R scripts in batch mode.
59
+
1. Check R package versions installed on SQL Server. For more information, see [Get R package information](determine-which-packages-are-installed-on-sql-server.md#get-the-r-library-location).
50
60
51
-
To locate these tools, determine the R library that was installed when you set up SQL Server or the standalone machine learning feature. For example, in a default installation, the R tools are located in these folders:
61
+
1. Install Microsoft R Client or one of the standalone server options to add RevoScaleR and other R packages, including the base R distribution used by your SQL Server instance. Choose a version at the same level or lower (packages are backward compatible) that provides the same package versions as those on the server. For version information, see the version map in this article: [Upgrade R and Python components](use-sqlbindr-exe-to-upgrade-an-instance-of-sql-server.md).
52
62
53
-
+ SQL Server 2016 R Services: `~\Program Files\Microsoft SQL Server\MSSQL13.<instancename>\R_SERVICES\bin\x64`
54
-
+ Microsoft R Server Standalone: `~\Program Files\Microsoft R\R_SERVER\bin\x64`
+ Machine Learning Server (Standalone): `~\Program Files\Microsoft\ML Server\R_SERVER\bin\x64`
63
+
1. In RStudio, [update your R path](https://support.rstudio.com/hc/articles/200486138-Using-Different-Versions-of-R) to point to the R environment providing RevoScaleR, Microsoft R Open, and other Microsoft packages. Depending on how you obtained RevoScaleR and other libraries, it is most likely one of the following paths:
57
64
58
-
If you need help with the R tools, just open **RGui**, click **Help**, and select one of the options
Microsoft R Client is a free download that gives you access to the RevoScaleR packages for development use. By installing R Client, you can create R solutions that can be run in all supported compute contexts, including SQL Server in-database analytics, and distributed R computing on Hadoop, Spark, or Linux using Machine Learning Server.
71
+
If you don't already have a preferred IDE for R, we recommend **R Tools for Visual Studio**.
63
72
64
-
If you have already installed a different R development environment, such as RStudio, be sure to reconfigure the environment to use the libraries and executables provided by Microsoft R Client. By doing so you can use all the features of the RevoScaleR package, although performance will be limited.
73
+
+[Download R Tools for Visual Studio (RTVS)](https://visualstudio.microsoft.com/vs/features/rtvs/)
74
+
+[Installation instrructions](https://docs.microsoft.com/visualstudio/rtvs/installing-r-tools-for-visual-studio) - RTVS is available in several versions of Visual Studio.
75
+
+[Get started with R Tools for Visual Studio](https://docs.microsoft.com/visualstudio/rtvs/getting-started-with-r)
65
76
66
-
For more information, see [What is Microsoft R Client?](https://docs.microsoft.com/machine-learning-server/r-client/what-is-microsoft-r-client)
67
-
68
-
## Install a development environment
69
-
70
-
If you don't already have a preferred R development environment, we recommend one of the following:
71
-
72
-
+ R Tools for Visual Studio
73
-
74
-
Works with Visual Studio 2015.
75
-
76
-
For setup information, see [How to install R Tools for Visual Studio](https://docs.microsoft.com/visualstudio/rtvs/installation).
77
-
78
-
To configure RTVS to use your Microsoft R client libraries, see [About Microsoft R Client](https://docs.microsoft.com/machine-learning-server/r-client/what-is-microsoft-r-client)
79
-
80
-
+ Visual Studio 2017
81
-
82
-
Even the free Community Edition includes the data science workload, which installs project templates for R, Python, and F#.
83
-
84
-
Download Visual Studio from [this site](https://www.visualstudio.com/vs/).
85
-
86
-
+ RStudio
87
-
88
-
If you prefer to use RStudio, some additional steps are required to use the RevoScaleR libraries:
89
-
90
-
- Install Microsoft R Client to get the required packages and libraries.
91
-
- Update your R path to use the Microsoft R runtime.
92
-
93
-
For more information, see [R Client - configure your IDE](https://docs.microsoft.com/machine-learning-server/r-client/what-is-microsoft-r-client#step-2-configure-your-ide).
94
-
95
-
## Configure your IDE
96
-
97
-
+ R Tools for Visual Studio
98
-
99
-
See [this site](https://docs.microsoft.com/visualstudio/rtvs/getting-started-with-r) for some examples of how to build and debug R projects using R Tools for Visual Studio.
100
-
101
-
+ Visual Studio 2017
102
-
103
-
If you install Microsoft R Client or R Server **before** you install Visual Studio, the R Server libraries are automatically detected and used for your library path. If you have not installed the RevoScaleR libraries, from the **R Tools** menu, select **Install R Client**.
104
-
105
-
## Run R in SQL Server
77
+
### Connect to SQL Server from RTVS
106
78
107
79
This example uses Visual Studio 2017 Community Edition, with the data science workload installed.
108
80
@@ -132,7 +104,6 @@ This example uses Visual Studio 2017 Community Edition, with the data science wo
132
104
sampleDataQuery<-"SELECT TOP 100 * from [dbo].[MyTestTable]"
0 commit comments