Offline Installation of R and Python

Make sure to install Python and R on the same machine where the AI Service is installed. Pyramid currently uses R version 4.02 and Python version is 3.7.0.

Note: This must be done for every AI server.

The installation files can be found below:

Details for adding R on Linux systems can be found at RStudio-r-builds site

R Offline Installation

The following R packages must be installed:

  • stringr
  • outliers
  • chainLadder
  • arules
  • dbscan
  • cluster
  • jsonlite
  • httpuv
  • logging

To install these packages offline, you can download a compressed file that matches your operating system from https://cran.r-project.org/web/packages/; copy the file to your offline machine. In some cases you'll have to download the dependencies packages as well; if this is required, it will be noted under your package link.

Note: The package must be installed on the same machine as the R installation.

During the installation process you may also need to install compilation tools for your operating system.

Example: Installation from zip for Windows

install.packages("path_of_zip(.zip)", repos=NULL, type = "win.binary",lib='D:/R/R-3.6.0/library/')

Example: Installation from tar.gz for Linux

install.packages("path_of_source(.tar.gz)", repos = NULL, type="source", lib='/usr/lib64/R/library')

Python Offline Installation

When installing Python, be sure to also install pip, which is the package manager for Python.

The following Python packages must be installed (the recommended version is noted beside each package):

  • pandas 0.24.2
  • DateTime 4.3
  • psutil 5.6.2
  • geopy 1.11.0 *
  • apyori 1.1.1 *
  • scikit-learn 0.19.2 *
  • scipy 1.1.0 *
  • sklearn 0.0 *
  • tensorflow 1.13.0 *
  • yahoofinancials 0.5 *
  • iexfinance 0.3.4 *
  • boto3 1.9.216 *
  • CensusData 1.3 *
  • holtwinters 1.0 *
  • numpy 1.19.2 *
  • protobuf 3.20.0 *

* Only required for the default Python environment.

To install these packages offline you can search for your package compressed file here: https://pypi.org/project/pip/. To install the package file, enter the following command in the pip package manager that you have installed:

pip install package_path (e.g. pip install C:\Downloads\geopy-1.11.0.tar.gz)

Python and R Installation for Windows

While Linux and other operating systems require that the packages be compressed via a compression tool, Windows does not have this requirement. If installing Python or R for Windows, it may be simplest to install an environment on an online machine and copy and paste the whole environment to your offline Windows machine.

Installation of Packages from an Online Repository

The below commands are relevant in case of online installation.

R

install.packages(c('stringr','outliers','ChainLadder','arules','dbscan','cluster','jsonlite','httpuv','logging'), lib= 'library', repos='the repository to download from e.g. https://cloud.r-project.org/')

Python

pip install pandas==0.24.2 DateTime==4.3 psutil==5.6.2 geopy==1.11.0 apyori==1.1.1 scikit-learn==0.19.2 scipy==1.1.0 sklearn==0.0 tensorflow==1.13.1 yahoofinancials==0.5 iexfinance==0.3.4 boto3==1.9.216 CensusData==1.3 holtwinters==1.0 numpy==1.19.2 protobuf==3.20.0

Adding the Offline Environment

Once the packages are installed, the offline environment needs to be installed.

For more information, see Add a Virtual Environment.