Package Management for TERR Service

If you create a Spotfire analysis that uses R packages from a repository like CRAN, then you must make sure that the packages are installed on Spotfire Server.

R programmers in your organization can develop their own packages for use in Spotfire. Alternatively, an analyst developing a data function for a Spotfire analysis can take advantage of one of the thousands of compatible packages developed by other R programmers. The largest and most commonly-used, curated repository for R packages is the Comprehensive R Archive Network (CRAN). Most packages that are not installed with the TERR service are downloaded from this repository. Comprehensive testing results for CRAN package compatibility are available for Windows and Linux.

Important: By default, the TERR engine runs in "Restricted Execution" mode, where attempting to execute certain operations defined as restricted (such as installing packages or performing any I/O operation) generates an error. This option is meant to protect your system from potentially malicious code running in the global environment. To enable your data function developers to upload and use packages, you must allow the TERR service to run in unrestricted mode. For more information about restricted mode, see the TERR language reference for evalREX. For more information on setting trust options for data functions and scripts in Spotfire, see the topic Script and Data Function Trust in the Spotfire Analyst Help.
An administrator who installs the R packages must do the following.
  • Coordinate with the author of a Spotfire data function to ensure that all R packages that are used in the analysis are installed on the host computer running the nodes that the TERR service is running on.
  • Ensure that all required and dependent packages associated with the needed packages are also installed. (The author of the data function can provide the administrator with this information.)
Important: When you install packages from the TERR console or TERR installed with the Spotfire® Analyst on the desktop, you usually install them using a script such as install.packages(c("packagename", "packagename")). However, if you try to install packages using such a script from the TERR service then the packages are not available to the entire service. To ensure that the packages you need are available to the entire service, you need to install them on the host computer running the TERR service

You can install packages for the TERR service in two ways.

  • Use the SPK mechanism on the Spotfire Server. Packages are stored as part of the deployment and are accessible to a TERR service engine running on a node when the engine session is created. This package installation method requires that you create and manually maintain a Debian Control File (DCF) that lists all packages to be installed, including dependent packages. Because the DCF controls SPK versioning, it provides better package governance than directly uploading to the server.
  • Manually install packages on the host computer running the TERR service. This method makes the packages accessible to a TERR service engine running on a node when the engine session is created. This method is the most efficient, because calling install.packages() directly on the server ensures that all dependent packages are also installed. If you use this method, you must specify the package path in the custom configuration file.