Offline Installation of R and Python

Make sure to install Python and R on the same machine where the AI Service is installed. (missing or bad snippet)

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
  • 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-4.4.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 for any offline environment (the recommended version is noted beside each package):

  • numpy==1.26.4
  • pandas==2.2.2
  • cryptography==42.0.8

The following Python packages must be installed if the environment is set as the default Python environment:

  • apyori==1.1.2
  • geopy==2.4.1
  • scikit-learn==1.4.2
  • scipy==1.13.1
  • yahoofinancials==1.20
  • iexfinance==0.5.0
  • boto3==1.34.128
  • holtwinters==1.0
  • numpy==1.26.4
  • pandas==2.2.2
  • cryptography==42.0.8

Note: If the preceding Packages are needed, then the Python version must be 3.11.

When installing Python manually, you must create a virtual environment.

To install these packages offline:

  1. Once Python is installed, run the following from the Python installation location:
  2. <Python location>\python.exe -m venv <Administrator Desktop>\myenv

  3. Then, use the environment's path to install a package (such as panda) using pip:
  4. <Administrator Desktop>\myenv\Scripts\pip.exe install pandas

  5. Finally, after the packages are installed into the virtual environment, refer to the virtual environment's path when importing it into Pyramid:
  6. <Administrator Desktop>\myenv\Scripts\python.exe

    <Administrator Desktop>\myenv\Scripts\pip.exe

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 following commands are relevant in case of online installation.

R

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

Python

pip install numpy==1.26.4 pandas==2.2.2 cryptography==42.0.8 apyori==1.1.2 geopy==2.4.1 scikit-learn==1.4.2 scipy==1.13.1 yahoofinancials==1.20 iexfinance==0.5.0 boto3==1.34.128 holtwinters==1.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.