Events
31 Mar, 23 - 2 Apr, 23
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
SQL Server 2016 (13.x) and later versions
This article provides instructions for installing SQL Server Machine Learning Services with Python and R from a command line.
You can specify silent, basic, or full interaction with the Setup user interface. This article supplements Install SQL Server from the Command Prompt, covering the parameters unique to R and Python machine learning components.
Note
Feature capabilities and installation options vary between versions of SQL Server. Use the version selector dropdown to choose the appropriate version of SQL Server.
Run commands from an elevated command prompt.
A database engine instance is required for in-database installations. You cannot install just R or Python features, although you can add them incrementally to an existing instance. If you want just R and Python without the database engine, install the standalone server.
Do not install on a failover cluster. The security mechanism used for isolating R and Python processes is not compatible with a Windows Server failover cluster environment.
Do not install on a domain controller. The Machine Learning Services portion of setup will fail.
Avoid installing standalone and in-database instances on the same computer. A standalone server will compete for the same resources, undermining the performance of both installations.
The /FEATURES argument is required, as are licensing term agreements.
When installing through the command prompt, SQL Server supports full quiet mode by using the /Q parameter, or Quiet Simple mode by using the /QS parameter. The /QS switch only shows progress, does not accept any input, and displays no error messages if encountered. The /QS parameter is only supported when /Action=install is specified.
Arguments | Description |
---|---|
/FEATURES = AdvancedAnalytics | Installs the in-database version: SQL Server R Services (In-Database). |
/FEATURES = SQL_SHARED_MR | Installs the R feature for the standalone version: SQL Server R Server (Standalone). A standalone server is a "shared feature" not bound to a database engine instance. |
/IACCEPTROPENLICENSETERMS | Indicates you have accepted the license terms for using the open source R components. |
/IACCEPTPYTHONLICENSETERMS | Indicates you have accepted the license terms for using the Python components. |
/IACCEPTSQLSERVERLICENSETERMS | Indicates you have accepted the license terms for using SQL Server. |
/MRCACHEDIRECTORY | For offline setup, sets the folder containing the R component CAB files. |
Arguments | Description |
---|---|
/FEATURES = AdvancedAnalytics | Installs the in-database version: SQL Server Machine Learning Services (In-Database). |
/FEATURES = SQL_INST_MR | Pair this with AdvancedAnalytics. Installs the (In-Database) R feature, including Microsoft R Open and the proprietary R packages. |
/FEATURES = SQL_INST_MPY | Pair this with AdvancedAnalytics. Installs the (In-Database) Python feature, including Anaconda and the proprietary Python packages. |
/FEATURES = SQL_SHARED_MR | Installs the R feature for the standalone version: SQL Server Machine Learning Server (Standalone). A standalone server is a "shared feature" not bound to a database engine instance. |
/FEATURES = SQL_SHARED_MPY | Installs the Python feature for the standalone version: SQL Server Machine Learning Server (Standalone). A standalone server is a "shared feature" not bound to a database engine instance. |
/IACCEPTROPENLICENSETERMS | Indicates you have accepted the license terms for using the open source R components. |
/IACCEPTPYTHONLICENSETERMS | Indicates you have accepted the license terms for using the Python components. |
/IACCEPTSQLSERVERLICENSETERMS | Indicates you have accepted the license terms for using SQL Server. |
/MRCACHEDIRECTORY | For offline setup, sets the folder containing the R component CAB files. |
/MPYCACHEDIRECTORY | Reserved for future use. Use %TEMP% to store Python component CAB files for installation on computers that do not have an internet connection. |
Arguments | Description |
---|---|
/FEATURES = AdvancedAnalytics | Installs the in-database version: SQL Server Machine Learning Services (In-Database). |
/FEATURES = SQL_INST_MR | Pair this with AdvancedAnalytics. Installs the (In-Database) R feature, including Microsoft R Open and the proprietary R packages. |
/FEATURES = SQL_INST_MPY | Pair this with AdvancedAnalytics. Installs the (In-Database) Python feature, including Anaconda and the proprietary Python packages. |
/FEATURES = SQL_INST_MJAVA | Pair this with AdvancedAnalytics. Installs the (In-Database) Java feature, including Open JRE. Applies to SQL Server Java Language Extension. |
/FEATURES = SQL_SHARED_MR | Installs the R feature for the standalone version: SQL Server Machine Learning Server (Standalone). A standalone server is a "shared feature" not bound to a database engine instance. |
/FEATURES = SQL_SHARED_MPY | Installs the Python feature for the standalone version: SQL Server Machine Learning Server (Standalone). A standalone server is a "shared feature" not bound to a database engine instance. |
/IACCEPTROPENLICENSETERMS | Indicates you have accepted the license terms for using the open source R components. |
/IACCEPTPYTHONLICENSETERMS | Indicates you have accepted the license terms for using the Python components. |
/IACCEPTSQLSERVERLICENSETERMS | Indicates you have accepted the license terms for using SQL Server. |
/MRCACHEDIRECTORY | For offline setup, sets the folder containing the R component CAB files. |
/MPYCACHEDIRECTORY | Reserved for future use. Use %TEMP% to store Python component CAB files for installation on computers that do not have an internet connection. |
Arguments | Description |
---|---|
/FEATURES = AdvancedAnalytics | Installs the in-database version: SQL Server Machine Learning Services (In-Database). |
/IACCEPTSQLSERVERLICENSETERMS | Indicates you have accepted the license terms for using SQL Server. |
In-database analytics are available for database engine instances, required for adding the AdvancedAnalytics feature to your installation. You can install a database engine instance with advanced analytics, or add it to an existing instance.
To view progress information without the interactive on-screen prompts, use the /qs argument.
Important
After installation, two additional configuration steps remain. Integration is not complete until these tasks are performed. See Post-installation configuration for instructions.
For a concurrent installation of the database engine instance, provide the instance name and an administrator (Windows) login. Include features for installing core and language components, as well as acceptance of all licensing terms.
Setup.exe /qs /ACTION=Install /FEATURES=SQLEngine,ADVANCEDANALYTICS
/INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS="<Windows-username>"
/IACCEPTSQLSERVERLICENSETERMS
For a concurrent installation of the database engine instance, provide the instance name and an administrator (Windows) login. Include features for installing core and language components, as well as acceptance of all licensing terms.
Setup.exe /qs /ACTION=Install /FEATURES=SQLEngine,ADVANCEDANALYTICS,SQL_INST_MR,SQL_INST_MPY
/INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS="<Windows-username>"
/IACCEPTSQLSERVERLICENSETERMS /IACCEPTROPENLICENSETERMS /IACCEPTPYTHONLICENSETERMS
This the same command, but with a SQL Server login on a database engine using mixed authentication.
Setup.exe /q /ACTION=Install /FEATURES=SQLEngine,ADVANCEDANALYTICS,SQL_INST_MR,SQL_INST_MPY
/INSTANCENAME=MSSQLSERVER /SECURITYMODE=SQL /SAPWD="%password%" /SQLSYSADMINACCOUNTS="<sql-username>"
/IACCEPTSQLSERVERLICENSETERMS /IACCEPTROPENLICENSETERMS /IACCEPTPYTHONLICENSETERMS
This example is Python only, showing that you can add one language by omitting a feature.
Setup.exe /qs /ACTION=Install /FEATURES=SQLEngine,ADVANCEDANALYTICS,SQL_INST_MPY
/INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS="<username>"
/IACCEPTSQLSERVERLICENSETERMS /IACCEPTPYTHONLICENSETERMS
For a concurrent installation of the database engine instance, provide the instance name and an administrator (Windows) login. Include features for installing core and language components, as well as acceptance of all licensing terms.
Setup.exe /qs /ACTION=Install /FEATURES=SQLEngine,ADVANCEDANALYTICS,SQL_INST_MR
/INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS="<Windows-username>"
/IACCEPTSQLSERVERLICENSETERMS /IACCEPTROPENLICENSETERMS
Applies to in-database installations only.
When SQL Setup for SQL Server 2016 (13.x), SQL Server 2017 (14.x), and SQL Server 2019 (15.x) is finished, you have a database engine instance with R and Python, the Microsoft R and Python packages, Microsoft R Open, Anaconda, tools, samples, and scripts that are part of the distribution.
Beginning with SQL Server 2022 (16.x), runtimes for R, Python, and Java, are no longer installed with SQL Setup. Instead, install your desired R and/or Python custom runtime(s) and packages. For more information, see Install SQL Server 2022 Machine Learning Services on Windows or Install SQL Server Machine Learning Services (Python and R) on Linux.
Two more tasks are required to complete the installation:
Restart the database engine service.
SQL Server Machine Learning Services: Enable external scripts before you can use the feature. Follow the instructions in Install SQL Server Machine Learning Services (In-Database) as your next step.
Restart the database engine service.
SQL Server R Services: Enable external scripts before you can use the feature. Follow the instructions in Install SQL Server R Services (In-Database) as your next step.
When adding in-database advanced analytics to an existing database engine instance, provide the instance name. For example, if you previously installed a SQL Server 2017 or later database engine and Python, you could use this command to add R.
Setup.exe /qs /ACTION=Install /FEATURES=SQL_INST_MR /INSTANCENAME=MSSQLSERVER
/IACCEPTSQLSERVERLICENSETERMS /IACCEPTROPENLICENSETERMS
When adding in-database advanced analytics to an existing database engine instance, provide the instance name. For example, if you previously installed a SQL Server 2022 (16.x) and later database engine, you can add the Machine Learning Services feature with the following:
Setup.exe /qs /ACTION=Install /FEATURES=ADVANCEDANALYTICS /INSTANCENAME=MSSQLSERVER
/IACCEPTSQLSERVERLICENSETERMS /IACCEPTROPENLICENSETERMS
For a silent installation of SQL Server 2022 (16.x), use the following sample:
Setup.exe /q /ACTION=Install /FEATURES=SQLEngine,ADVANCEDANALYTICS
/INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS="<username>"
/IACCEPTSQLSERVERLICENSETERMS
A silent installation suppresses the check for .cab file locations. For this reason, you must specify the location where .cab files are to be unpacked. For Python, CAB files must be located in %TEMP*. For R, you can set the folder path using you can the temp directory for this.
Setup.exe /q /ACTION=Install /FEATURES=SQLEngine,ADVANCEDANALYTICS,SQL_INST_MR,SQL_INST_MPY
/INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS="<username>"
/IACCEPTSQLSERVERLICENSETERMS /IACCEPTROPENLICENSETERMS /IACCEPTPYTHONLICENSETERMS
/MRCACHEDIRECTORY=%temp%
Important
The support for Machine Learning Server (previously known as R Server) ended on July 1, 2022. For more information, see What's happening to Machine Learning Server?
Applies to: SQL Server 2016 (13.x), SQL Server 2017 (14.x), and SQL Server 2019 (15.x) only.
A standalone server is a "shared feature" not bound to a database engine instance. The following examples show valid syntax for installation of the standalone server.
SQL Server Machine Learning Server supports Python and R on a standalone server:
Setup.exe /q /ACTION=Install /FEATURES=SQL_SHARED_MR,SQL_SHARED_MPY
/IACCEPTROPENLICENSETERMS /IACCEPTPYTHONLICENSETERMS /IACCEPTSQLSERVERLICENSETERMS
SQL Server R Server is R-only:
Setup.exe /q /ACTION=Install /FEATURES=SQL_SHARED_MR
/IACCEPTROPENLICENSETERMS /IACCEPTSQLSERVERLICENSETERMS
When SQL Setup for SQL Server 2016 (13.x), SQL Server 2017 (14.x), and SQL Server 2019 (15.x) is finished, you have a server, Microsoft packages, open-source distributions of R and Python, tools, samples, and scripts that are part of the distribution.
Beginning with SQL Server 2022 (16.x), runtimes for R, Python, and Java, are no longer installed with SQL Setup. Instead, install your desired R and/or Python custom runtime(s) and packages. For more information, see Install SQL Server 2022 Machine Learning Services on Windows or Install SQL Server Machine Learning Services (Python and R) on Linux.
To open an R console window, go to \Program files\Microsoft SQL Server\150(or 140,130)\R_SERVER\bin\x64
and double-click RGui.exe. New to R? Try this tutorial: Basic R commands and RevoScaleR functions: 25 common examples.
To open a Python command, go to \Program files\Microsoft SQL Server\150 (or 140)\PYTHON_SERVER\bin\x64
and double-click python.exe.
Python developers can learn how to use Python with SQL Server by following these tutorials:
R developers can get started with some simple examples, and learn the basics of how R works with SQL Server. For your next step, see the following links:
Events
31 Mar, 23 - 2 Apr, 23
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register today