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

Use pip3.12 to install the supporting packages. For OML4Py client installation of all the packages, run the following command, specifying the package:

pip3.12 install packagename

These commands install the required packages:

pip3.12 install pandas==2.1.1
pip3.12 install scipy==1.12.0
pip3.12 install matplotlib==3.7.2
pip3.12 install oracledb==2.0.1
pip3.12 install joblib==1.2.0
pip3.12 install scikit-learn==1.2.1
pip3.12 install numpy==1.26.4

Note:

scikit-learn will be installed from source on Linux 7 and 8 and matplotlib will be installed from source on Linux 7.

Note:

The proxy server is only necessary if the user is behind a firewall. This command installs the pandas library using an example proxy server:
pip3.12 install pandas==2.1.1 --proxy="http://www-proxy.example.com:80"

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. Run the following command, specifying the package and target directory, $ORACLE_HOME/oml4py/modules:

pip3.12 install packagename --target=$ORACLE_HOME/oml4py/modules

These commands install the commonly required packages on Oracle Linux 7 and Oracle Linux 8:

pip3.12 install pandas==2.1.1--target=$ORACLE_HOME/oml4py/modules
pip3.12 install scipy==1.12.0 --target=$ORACLE_HOME/oml4py/modules
pip3.12 install oracledb==2.0.1 --target=$ORACLE_HOME/oml4py/modulesdules
pip3.12 install joblib==1.2.0 --target=$ORACLE_HOME/oml4py/modules
pip3.12 install numpy==1.26.4 --target=$ORACLE_HOME/oml4py/modules

Build matplotlib 3.7.2 on Oracle Linux 7

  1. Download matplotlib-3.7.2: matplotlib-3.7.2.tar.gz
  2. Extract to and change directory to matplotlib-3.7.2.
    tar xfvz matplotlib-3.7.2.tar.gz
    cd matplotlib-3.7.2/
  3. Build matplotlib module:
    python3 -m pip install setuptools
    python3 -m pip install —upgrade build
    export CFLAGS=-std=c++11
    python3 -m build
    A successful build will return the message:
    Successfully built matplotlib-3.7.2.tar.gz and matplotlib-3.7.2-cp312-cp312-linux_x86_64.whl
  4. Install the module:
    python3 -m pip install ./dist/matplotlib-3.7.2-cp312-cp312-linux_x86_64.whl —target=$ORACLE_HOME/oml4py/modules
Build the scikit-learn 1.2.1 python module on both Oracle Linux 7 and Oracle Linux 8.
  1. Download scikit_learn-1.2.1: scikit_learn-1.2.1.tar.gz
  2. Extract to and change directory to scikit-learn-1.2.1.
    tar xvfz scikit-learn-1.2.1.tar.gz
    cd scikit_learn-1.2.1
  3. Build scikit-learn module:
    pip3.12 install setuptools
    python3 -m pip install —upgrade build
    python3 -m build
    A successful build will return the message:
    Successfully built scikit_learn-1.2.1.tar.gz and scikit_learn-1.2.1-cp312-cp312-linux_x86_64.whl
  4. Install the module:
    pip3.12 install ./dist/scikit_learn-1.2.1-cp312-cp312-linux_x86_64.whl

Note:

The proxy server is only necessary if the user is behind a firewall. This command installs the pandas library using an example proxy server:
pip3.12 install pandas==2.1.1 --proxy="http://www-proxy.example.com:80" --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.0 (default, Feb 22 2022, 15:13:36)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44.0.3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import numpy
import pandas
import scipy
import matplotlib
import oracledb
import sklearn

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