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:
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 thepandas
library using an
example proxy
server:pip3.12 install pandas==2.1.1 --proxy="http://www-proxy.example.com:80"
These steps outline how to install the required Python packages for an on-premises OML4Py client:
- Create a file named
requirements.txt
containing the following content:pandas==2.1.1 scipy==1.12.0 matplotlib==3.7.2 oracledb==1.4.2 joblib==1.2.0 scikit-learn==1.2.1 numpy==1.26.4
- 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
commands install the commonly required packages on Oracle Linux 7
and Oracle Linux 8.
These steps outline how to install the required Python packages for an on-premises OML4Py server:
- Create a file named
requirements2.txt
containing the following content.pandas==2.1.1 scipy==1.12.0 oracledb==1.4.2 joblib==1.2.0 scikit-learn==1.2.1 numpy==1.26.4
- 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
Build matplotlib 3.7.2
on Oracle Linux 7
- Download
matplotlib-3.7.2
: matplotlib-3.7.2.tar.gz - Extract to and change directory to
matplotlib-3.7.2
.tar xfvz matplotlib-3.7.2.tar.gz cd matplotlib-3.7.2/
- Build matplotlib
module:
A successful build will return the message:python3 -m pip install setuptools python3 -m pip install —upgrade build export CFLAGS=-std=c++11 python3 -m build
Successfully built matplotlib-3.7.2.tar.gz and matplotlib-3.7.2-cp312-cp312-linux_x86_64.whl
- Install the
module:
python3 -m pip install ./dist/matplotlib-3.7.2-cp312-cp312-linux_x86_64.whl —target=$ORACLE_HOME/oml4py/modules
scikit-learn 1.2.1
python module on both
Oracle Linux 7 and Oracle Linux 8.- Download
scikit_learn-1.2.1
: scikit_learn-1.2.1.tar.gz - 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
- Build scikit-learn
module:
A successful build will return the message:pip3.12 install setuptools python3 -m pip install —upgrade build python3 -m build
Successfully built scikit_learn-1.2.1.tar.gz and scikit_learn-1.2.1-cp312-cp312-linux_x86_64.whl
- 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 thepandas
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
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.
- Commands Summary for Installing Required Supporting Packages for Linux for On-Premises Databases
The commands used for installing required supporting packages for linux for On-Premises databases are listed in the following example.
Parent topic: Install OML4Py for On-Premises Databases