| title | Upgrade Python and R components |
|---|---|
| description | Upgrade Python and R in SQL Server Machine Learning Services or SQL Server R Services using sqlbindr.exe to bind to Machine Learning Server. |
| ms.prod | sql |
| ms.technology | machine-learning |
| ms.date | 04/03/2020 |
| ms.topic | conceptual |
| author | cawrites |
| ms.author | chadam |
| monikerRange | >=sql-server-2016||=sqlallproducts-allversions |
[!INCLUDEappliesto-ss-xxxx-xxxx-xxx-md-winonly]
Python and R integration in SQL Server includes open-source and Microsoft-proprietary packages.
Standard SQL Server servicing:
- Packages are updated according to the SQL Server release cycle.
- Bug fixes are applied to existing packages at the current version.
- No major version upgrades.
You can get newer versions of Python and R by binding to Microsoft Machine Learning Server. The version applies to both SQL Server Machine Learning Services (In-Database) and SQL Server R Services (In-Database).
The ability to obtain newer packages is preferred if you work in a data-related filed, like a data scientist.
Binding is an installation process that swaps out the contents of your R_SERVICES and PYTHON_SERVICES folders with newer executables, libraries, and tools from Microsoft Machine Learning Server.
The uploaded components included with the servicing model has changed.
The service updates match the support Timeline for Microsoft R Server & Machine Learning Server on the Modern Lifecycle.
Except for component versions and service updates, binding doesn't change the basics of your installation:
- Python and R integration is still part of a database engine instance.
- Licensing is unchanged (no additional costs associated with binding).
- SQL Server support policies still hold for the database engine.
The rest of this article explains the binding mechanism and how it works for each version of SQL Server.
Note
Binding applies to (in-database) instances only that are bound to SQL Server instances. In this case binding is not necessary for a (Standalone) installation.
::: moniker range="=sql-server-2016||=sqlallproducts-allversions" SQL Server 2016 binding considerations
For SQL Server 2016 R Services customers, binding provides:
- Updated R packages.
- New packages not part of the original installation ([MicrosoftML](https:// docs.microsoft.com/machine-learning-server/r-reference/microsoftml/microsoftml-package))
- Pre-trained machine learning modelsfor sentiment analysis and image detection.
All of the binding can further be refreshed at each new major and minor release of Microsoft Machine Learning Server. ::: moniker-end
The following tables are version maps. Each map shows package versions across releases. You can review upgrade paths when you bind to Microsoft Machine Learning Server (previously known as R Server, before the addition of Python support starting in Machine Learning Server 9.2.1).
The binding does not guarantee the latest version of R or Anaconda. When you bind to Microsoft Machine Learning Server, you get the R or Python version installed through Setup, which may not be the latest version available on the web.
::: moniker range="=sql-server-2016||=sqlallproducts-allversions" SQL Server 2016 R Services
| Component | Initial Release | R Server 9.0.1 | R Server 9.1 | Machine Learning Server 9.2.1 | Machine Learning Server 9.3 |
|---|---|---|---|---|---|
| Microsoft R Open (MRO) over R | R 3.2.2 | R 3.3.2 | R 3.3.3 | R 3.4.1 | R 3.4.3 |
| RevoScaleR | 8.0.3 | 9.0.1 | 9.1 | 9.2.1 | 9.3 |
| MicrosoftML | n.a. | 9.0.1 | 9.1 | 9.2.1 | 9.3 |
| pretrained models | n.a. | 9.0.1 | 9.1 | 9.2.1 | 9.3 |
| sqlrutils | n.a. | 1.0 | 1.0 | 1.0 | 1.0 |
| olapR | n.a. | 1.0 | 1.0 | 1.0 | 1.0 |
| ::: moniker-end |
::: moniker range="=sql-server-2017||=sqlallproducts-allversions" SQL Server 2017 Machine Learning Services
Component |Initial Release | Machine Learning Server 9.3 | | | | ----------|----------------|---------|-|-|-|-| Microsoft R Open (MRO) over R | R 3.3.3 | R 3.4.3 | | | | RevoScaleR | 9.2 | 9.3 | | | | MicrosoftML | 9.2 | 9.3| | | | sqlrutils| 1.0 | 1.0 | | | | olapR | 1.0 | 1.0 | | | | Anaconda 4.2 over Python 3.5 | 4.2/3.5.2 | 4.2/3.5.2 | | | | revoscalepy | 9.2 | 9.3| | | | microsoftml | 9.2 | 9.3| | | | pretrained models | 9.2 | 9.3| | | | ::: moniker-end
Executable files, Python, and R libraries are upgraded when you bind an existing installation of Python and R to Machine Learning Server.
Binding is executed by the Microsoft Machine Learning Server installer when you run Setup on an existing SQL Server database engine instance having Python or R integration.
Setup detects the existing features and prompts you to rebind to Machine Learning Server.
During binding, the contents of C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\R_SERVICES and \PYTHON_SERVICES is overwritten with the newer executable files and libraries of C:\Program Files\Microsoft\ML Server\R_SERVER and \PYTHON_SERVER.
Binding applies to Python and R features only. Open-source packages for Python and R consists of:
- Anaconda
- Microsoft R Open
- Proprietary packages RevoScaleR
- Revoscalepy
The binding doesn't change the support model for the database engine instance or the version of SQL Server.
Binding is reversible. You can revert to SQL Server servicing by unbinding the instance and reparing your SQL Server database engine instance.
Follow the steps below to bind SQL Server to Microsoft Machine Learning Server using setup.
-
In SSMS, run
SELECT @@versionto verify the server meets minimum build requirements.For SQL Server 2016 R Services, the minimum is Service Pack 1 and CU3.
-
Check the version of R base and RevoScaleR packages to confirm the existing versions are lower than what you plan to replace them with.
EXECUTE sp_execute_external_script @language=N'R' ,@script = N'str(OutputDataSet); packagematrix <- installed.packages(); Name <- packagematrix[,1]; Version <- packagematrix[,3]; OutputDataSet <- data.frame(Name, Version);' , @input_data_1 = N'' WITH RESULT SETS ((PackageName nvarchar(250), PackageVersion nvarchar(max) ))
-
Close down SSMS and any other tools having an open connection to SQL Server. Binding overwrites program files. If SQL Server has open sessions, binding will fail with bind error code 6.
-
Download Microsoft Machine Learning Server onto the computer that has the instance you want to upgrade. We recommend the latest version.
-
Unzip the folder and start ServerSetup.exe, located under MLSWIN93.
-
On Configure the installation, confirm the components to upgrade, and review the list of compatible instances.
-
On the License agreement page, select I accept these terms to accept the licensing terms for Machine Learning Server.
-
On successive pages, provide consent to additional licensing conditions for any open-source components you selected, such as Microsoft R Open or the Python Anaconda distribution.
-
On the Almost there page, make a note of the installation folder. The default folder is \Program Files\Microsoft\ML Server.
If you want to change the installation folder, click Advanced to return to the first page of the wizard. However, you must repeat all previous selections.
If upgrade fails, check SqlBindR error codes for more information.
For systems with no internet connectivity, you can download the installer and .cab files to an internet-connected machine, and then transfer files to the isolated server.
The installer (ServerSetup.exe) includes the Microsoft packages (RevoScaleR, MicrosoftML, olapR, sqlRUtils). The .cab files provide other core components. For example, the "SRO" cab provides R Open, Microsoft's distribution of open-source R.
The following instructions explain how to place the files for an offline installation.
-
Download the MLSWIN93 Installer. It downloads as a single zipped file. We recommend the latest version, but you can also install earlier versions.
-
Download .cab files. The following links are for the 9.3 release. If you require earlier versions, additional links can be found in R Server 9.1. Recall that Python/Anaconda can only be added to a SQL Server Machine Learning Services instance. Pre-trained models exist for both Python and R; the .cab provides models in the languages you are using.
Feature Download R SRO_3.4.3.0_1033.cab Python SPO_9.3.0.0_1033.cab Pre-trained models MLM_9.3.0.0_1033.cab -
Transfer .zip and .cab files to the target server.
-
On the server, type
%temp%in the Run command to get the physical location of the temp directory. The physical path varies by machine, but it is usuallyC:\Users\<your-user-name>\AppData\Local\Temp. -
Place the .cab files in the %temp% folder.
-
Unzip the Installer.
-
Run ServerSetup.exe and follow the on-screen prompts to complete the installation.
Tip
Can't find SqlBindR? You probably have not run Setup. SqlBindR is available only after running Machine Learning Server Setup.
-
Open a command prompt as administrator and navigate to the folder containing sqlbindr.exe. The default location is C:\Program Files\Microsoft\MLServer\Setup
-
Type the following command to view a list of available instances:
SqlBindR.exe /listMake a note of the full instance name as listed. For example, the instance name might be MSSQL14.MSSQLSERVER for a default instance, or something like SERVERNAME.MYNAMEDINSTANCE.
-
Run SqlBindR.exe command with the /bind argument. Specify the name of the instance to upgrade, using the instance name that was returned in the previous step.
For example, to upgrade the default instance, type:
SqlBindR.exe /bind MSSQL14.MSSQLSERVER -
When the upgrade has completed, restart the Launchpad service associated with any instance that has been modified.
You can restore a bound instance to an initial installation of the Python and R components, established by SQL Server Setup. There are three parts to reverting back to the SQL Server servicing.
- Step 1: Unbind from Microsoft Machine Learning Server
- Step 2: Restore the instance to original status
- Step 3: Reinstall any packages you added to the installation
You have two options for rolling back the binding: re-rerun setup or use SqlBindR command-line utility.
- Locate the installer for Machine Learning Server. If you have removed the installer, you may need to download it again, or copy it from another computer.
- Be sure to run the installer on the computer that has the instance you want to unbind.
- The installer identifies local instances that are candidates for unbinding.
- Deselect the check box next to the instance that you want to revert to the original configuration.
- Accept all licensing agreements.
- Click Finish. The process takes a while.
-
Open a command prompt and navigate to the folder that contains sqlbindr.exe, as described in the previous section.
-
Run the SqlBindR.exe command with the /unbind argument, and specify the instance.
For example, the following command reverts the default instance:
SqlBindR.exe /unbind MSSQL14.MSSQLSERVER
Run SQL Server Setup to repair the database engine instance having the Python and R features. Pre-existing updates are preserved. The next step applies if an update was missed for the servicing updates to Python and R packages.
Alternate solution: Fully uninstall and reinstall the database engine instance, and then apply all service updates.
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 Python and R are now using. For more information, see R package information and installation, and Python package information and installation.
sqlbindr [/list] [/bind <SQL_instance_ID>] [/unbind <SQL_instance_ID>]
| Name | Description |
|---|---|
| list | Displays a list of all SQL Database instance IDs on the current computer |
| bind | Upgrades the specified SQL Database instance to the latest version of R Server and ensures the instance automatically gets future upgrades of R Server |
| unbind | Uninstalls the latest version of R Server from the specified SQL Database instance and prevents future R Server upgrades from affecting the instance |
Machine Learning Server Installer and SqlBindR both return the following error codes and messages.
| Error code | Message | Details |
|---|---|---|
| Bind error 0 | Ok (success) | Binding passed with no errors. |
| Bind error 1 | Invalid arguments | Syntax error. |
| Bind error 2 | Invalid action | Syntax error. |
| Bind error 3 | Invalid instance | An instance exists, but is not valid for binding. |
| Bind error 4 | Not bindable | |
| Bind error 5 | Already bound | You ran the bind command, but the specified instance is already bound. |
| Bind error 6 | Bind failed | An error occurred while unbinding the instance. This error can occur if you run the Machine Learning Server installer without selecting any features. Binding requires that you select both an MSSQL instance and Python and R, assuming the instance is SQL Server 2017. This error also occurs if SqlBindR couldn't write to the Program Files folder. Open sessions or handles to SQL Server will cause this error to occur. If you get this error, reboot the computer and redo the binding steps before starting any new sessions. |
| Bind error 7 | Not bound | The database engine instance has R Services or SQL Server Machine Learning Services. The instance isn't bound to Microsoft Machine Learning Server. |
| Bind error 8 | Unbind failed | An error occurred while unbinding the instance. |
| Bind error 9 | No instances found | No database engine instances were found on this computer. |
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.
SqlBindR.exe fails to restore original packages or R components with upgrade to Microsoft R Server 9.0.1. Use SQL Server repair on instance and apply all service releases. Restart instance.
Later version of SqlBindR automatically restores the original R features, eliminating the need for reinstallation of R components or repatch the server. However, you must install any R package updates that might have been added after the initial installation.
Use R commands to synchronize installed packages to the file system using records in the database. For more information, see R package management for SQL Server.
Scenario: Previously upgraded instance of SQL Server 2016 R Services to 9.0.1. Executed the new installer for Microsoft R Server 9.1.0. The installer displays a list of all valid instances. By default installer selects previously bound instances. If you continue, the previously bound instances are unbound. The result is the earlier 9.0.1 installation is removed and any related packages, but the new version of Microsoft R Server (9.1.0) isn't installed.
As a workaround, you can modify the existing R Server installation as follows:
- In Control Panel, open Add or Remove Programs.
- Locate Microsoft R Server, and click Change/Modify.
- When the installer starts, select the instances you want to bind to 9.1.0.
Microsoft Machine Learning Server 9.2.1 and 9.3 don't have this issue.
Remove temporary folders after installation is complete.
Note
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.