4.3 Install the Required Supporting Packages for Linux for On-Premises Databases

Both the OML4Py server and client installations for an on-premises Oracle database require that you also install a set of supporting Python packages, as described below.

Installing required packages on OML4Py client machine

Note:

onnxruntime, onnxruntime-extensions, onnx, transformers, and sentencepiece are to be installed on the client only. onnxruntime, onnxruntime-extensions, onnx, transformers, and sentencepiece support the ONNX conversion feature on the OML4Py client and should installed on the client only. All other packages are installed on both the client and server.

Note:

oracledb 2.2.0 or later version is required to invoke vector database SQL APIs in 23ai.

These steps outline how to install the required Python packages for an on-premises OML4Py client:

  1. Create a file named requirements.txt containing the following content:
    --extra-index-url https://download.pytorch.org/whl/cpu
    pandas==2.2.2
    setuptools==70.0.0
    scipy==1.14.0
    matplotlib==3.8.4
    oracledb==2.4.1
    scikit-learn==1.5.1
    numpy==2.0.1
    onnxruntime==1.20.0
    onnxruntime-extensions==0.12.0
    onnx==1.17.0
    torch==2.6.0
    transformers==4.49.0
    sentencepiece==0.2.0
  2. Install the packages with requirements.txt.

    pip3.12 install -r requirements.txt

Installing required packages on OML4Py server machine

On the OML4Py server machine, all these packages must be installed into $ORACLE_HOME/oml4py/modules so they can be detected by the Embedded Python Execution process.

These steps outline how to install the required Python packages for an on-premises OML4Py server:

  1. Create a file named requirements2.txt containing the following content.

    pandas==2.2.2
    setuptools==70.0.0
    scipy==1.14.0
    matplotlib==3.8.4
    oracledb==2.4.1
    joblib==1.3.2
    scikit-learn==1.5.1.post1
    numpy==2.0.1
  2. Install the packages with requirements2.txt. Run the following command, specifying the target directory, $ORACLE_HOME/oml4py/modules:
    pip3.12 install -r requirements2.txt --target=$ORACLE_HOME/oml4py/modules

Verify the Package Installation

Load the packages below to ensure they have been installed successfully. Start Python and run the following commands:
python3
Python 3.12.6 (main, Aug 14 2024, 15:13:51) [GCC 8.5.0 20210514 (Red
Hat 8.5.0-18.0.6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import numpy
import pandas
import scipy
import matplotlib
import oracledb
import sklearn
import onnx
import torch
import onnxruntime_extensions
import transformers
import sentencepiece

If all the packages are installed successfully, no errors will be returned.