Installing stringi in an offline environment


The stringi and dependent packages are commonly used in R for string manipulation, regex parsing, and the like. However, stringi's system dependencies (libicu) can make for difficult installation in an offline environment.

Why installing stringi is hard offline

When in an online environment, the installation process of stringi is savvy enough to go get the system dependencies it needs at build time. This makes for a very friendly and simple user experience for most users. However, in an offline or semi-offline (protected by an outbound proxy) environment, this request for system dependencies from the internet may be rejected and will cause an installation failure.

There are several options to get stringi installed successfully on your system.

For more information on the installation process and system dependencies that the package uses, see the excellent writeup maintained by the package author:

At the time of writing, the latest stringi package installation requires the version of the ICU library to be >= 52.

Using RStudio Package Manager

RStudio Package Manager is a repository management server to organize and centralize R packages across your team, department, or entire organization. Two noteworthy features in this context are that it:

  • Provides a list of system dependencies for individual packages and entire repositories
  • Provides binary (pre-built) R packages for linux operating systems

As a result, RStudio Package Manager simplifies package management and installation for offline linux infrastructure by providing pre-built R packages and the list of system dependencies needed to run them.

In short, if you use RStudio Package Manager system dependencies and binaries, then stringi should install just fine in any online or offline supported linux environment.


Using RStudio Package Manager - Ubuntu (16.04, 18.04) & SUSE / SLES

When using Ubuntu and SUSE/SLES operating systems, RStudio Package Manager makes clear that system dependencies for stringi include:

  • Ubuntu: libicu-dev
  • SUSE / SLES: libicu-devel

Moreover, on these operating systems, the system-provided version of libicu is sufficient to satisfy stringi's requirements (>= 52). As a result, installing stringi from source or binary will pick up the system version of libicu and be built properly (even in an offline environment).

NOTE that binary installations will be much faster.

Using RStudio Package Manager - Other Systems, CentOS / RHEL (6, 7)

On other operating systems (i.e. Centos 6 & 7 at the time of writing), system dependencies for stringi are listed by RStudio Package Manager as:

  • Centos / RHEL: libicu-devel

However, on these systems, the system-provided version of libicu is not sufficient to satisfy stringi's version requirement. As a result, we recommend that you:

Install stringi from a binary on RStudio Package Manager. This will include appropriate bundled system dependencies and will work out of the box.

If you have to build stringi from source on one of these operating systems, please reach out to your Customer Success representative and share this use case with us. You can follow the directions below for "Without RStudio Package Manager."

Without RStudio Package Manager

When you are installing stringi without the option of binaries from RStudio Package Manager, then your installation process will require building the package from source. If your operating system provided version of libicu satisfies stringi's requirements, then you can build the package from source even in an offline or semi-offline environment.

At the time of writing, stringi's system dependencies are satisfied by the system provided version of libicu for the following operating systems:

  • Ubuntu 16.04, Ubuntu 18.04
  • SUSE 42.3, 15.0
  • SLES 12, 15

If your operating system provided version of libicu does not satisfy stringi's requirements, then you must either

At the time of writing, stringi's system dependencies are NOT satisfied by the system provided version of libicu for the following operating systems:

  • CentOS / RHEL 6, 7

Non-Interactive Environments like RStudio Connect

In Non-Interactive environments like RStudio Connect, the user or admin does not have control over the package installation process. As a result, manual installation of stringi is not an option. In this scenario, we recommend using RStudio Package Manager, which allows for non-interactive installation of stringi on all supported linux operating systems.

If RStudio Package Manager is not available, then you will need to:

  • Install the appropriate system dependencies
  • If stringi installation is still failing, then open up internet access to the locations that stringi tries to get its sources from
  • If opening up internet access is not an option, you will need to install stringi manually

Manual Installation on RStudio Connect

RStudio Connect allows for manual installation of packages through use of the Packages.External configuration option to tell Connect about "External Packages" (i.e. packages that are managed and installed manually and provided to RStudio Connect through the system library).

NOTE use of Packages.External is highly discouraged in all situations save exceptions like stringi, rJava, ROracle, etc. that have very particular system dependency requirements.

In the case of stringi:

  • Install stringi manually into the system library for each R installation utilized by RStudio Connect (this is most easily done by installing the package as root, which should default to the system library)
  • Add the following section to the RStudio Connect configuration at /etc/rstudio-connect/rstudio-connect.gcfg
External = stringi
  • Restart RStudio Connect

Once this is complete, the following behavior can be expected:

  • RStudio Connect will bypass installation of stringi when deploying R content and trust that it is available in the system library
  • If stringi is not available in the system library for all R installations, RStudio Connect will fail to start
  • All content using a given version of R will utilize the stringi installed into the system library for that R version
  • This means that updating, removing, or otherwise changing stringi in the system library will simultaneously affect all RStudio Connect content using the given R version.

There is more information about this process in the RStudio Connect Admin Guide. If you have questions or difficulties about the process of getting stringi to work with RStudio Connect, please reach out to your Customer Success representative or the RStudio support team.