3.4.1 Install OML4Py Server for Linux for On-Premises Oracle Database 19c

Instructions for installing the OML4Py server for Linux for an on-premises Oracle Database 19c.

To install the OML4Py server for Linux for an on-premises Oracle database, run the server installation Perl script.

Prerequisites

To install the on-premises OML4Py server, the following are required:
  • A connection to the internet.
  • Python 3.9.5. For instructions on installing Python 3.9.5 see Build and Install Python for Linux for On-Premises Databases.
  • OML4Py supporting packages. For instructions on installing the required supporting packages see Install the Required Supporting Packages for Linux for On-Premises Databases.
  • Perl 5.8 or higher installed on your system.

    Note:

    Perl requires the presence of the perl-Env package.
  • To verify if the perl-Env package exists on the system, type the command :
    rpm -qa perl-Env

    If it is installed, the return value will contain the version of the perl-Env RPM installed on your system:

    rpm -qa perl-Env
    perl-Env-1.04-2.el7.noarch

    If perl-Env is not installed on the system, there will be no return value, and you can install the package as root or sudo using the command:

    yum install perl-Env
  • Write permission on the directories to which you download and install the server components.

Download and Extract the Server Installation File

Download the on-premises OML4Py server installation file and extract its contents.

  1. If the directory oml4py does not exist in the $ORACLE_HOME directory, then create it.
    mkdir $ORACLE_HOME/oml4py
  2. Download the installation file for your system.
    1. Go to the Oracle Machine Learning for Python Downloads page on the Oracle Technology Network.
    2. Accept the license agreement and select Oracle Machine Learning for Python Downloads (v1.0).
    3. Select Oracle Machine Learning for Python Server Install for Oracle Database on Linux 64 bit.
    4. Save the file to the $ORACLE_HOME/oml4py directory.
  3. To extract the installation file to $ORACLE_HOME/oml4py directory, use the command:
    unzip oml4py-server-linux-x86_64-1.0.zip -d $ORACLE_HOME/oml4py

    The files are extracted to the $ORACLE_HOME/oml4py/server subdirectory.

View the Optional Arguments to the Server Installation Perl Script

To view the optional arguments to the server installation script, change directories to the $ORACLE_HOME/oml4py directory.

Display the available installation options with the following command:

perl -Iserver server/server.pl --help

The command displays the following:

Oracle Machine Learning for Python 1.0 Server.

Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved.

Usage: server.pl [OPTION]...
Install, upgrade, or uninstall OML4P Server.

  -i, --install         install or upgrade (default)
  -u, --uninstall       uninstall
  -y                    never prompt
  --ask                 interactive mode (default)
  --pdb NAME            PDB name
  --perm PERM           permanent tablespace to use for PYQSYS
  --temp TEMP           temporary tablespace to use for PYQSYS
  --no-db               do not configure the database; only install the
                        oml module and libraries associated with
                        Embedded Python Execution
  --no-embed            do not install the Embedded Python Execution
                        component
  --no-automl           do not install the AutoML metamodels

By default, the installation script installs both the Embedded Python Execution and AutoML components. If you do not want to install these components, then you can use the --no-embed and/or the --no-automl flag.

If you do not specify a permanent tablespace or a temporary tablespace in the Perl command, then the installation script prompts you for them.

If you only want to install the oml modules and Embedded Python Execution libraries with no database configuration, use the --no-db flag. The --no-db flag is used when OML4Py is installed in a database with multiple nodes, such as Oracle RAC. The OML4Py server requires a complete database configuration on the first node, but the oml module and Embedded Python Execution libraries must be installed on each node.

Run the Server Installation Perl Script

The installation Perl script creates the PYQSYS schema and user. It uses the permanent and temporary tablespaces that you specify to store OML4Py database objects and tables and other server elements. The PYQSYS user is locked to protect the system objects stored in the PYQSYS schema.

By default, the installation Perl script runs in interactive mode and installs the Embedded Python Execution components.

  1. You need to set the PYTHONPATH environment variable prior to running the server installation script so that Python can find the installed oml modules:
    export PYTHONPATH=$ORACLE_HOME/oml4py/modules
  2. From the $ORACLE_HOME/oml4py directory, run the server installation script. The following command runs the script in interactive mode:
    $ perl -Iserver server/server.pl

    Enter temporary and permanent tablespaces for the PYQSYS user when the script prompts you for them.

  3. When the installation script displays Proceed? , enter y or yes. The output of a successful installation is as follows:
    bash-4.4$ perl -Iserver server/server.pl
    
    Oracle Machine Learning for Python 1.0 Server.
    
    Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved.
    
    Checking platform .................. Pass
    Checking ORACLE_HOME ............... Pass
    Checking ORACLE_SID ................ Pass
    Checking sqlplus ................... Pass
    Checking ORACLE instance ........... Pass
    Checking CDB/PDB ................... Fail
      ERROR: cannot install OML4P in a root container
      PDB to use for OML4P installation [list]:
    ORCLPDB
      PDB to use for OML4P installation [list]: ORCLPDB
    Checking CDB/PDB ................... Pass
    Checking OML4P Server .............. Pass
    Checking Python .................... Pass
    Checking module dependencies ....... Pass
    Checking Python libraries .......... Pass
    Checking OML4P version ............. Pass
    
    Choosing PYQSYS tablespaces
      PERMANENT tablespace to use for PYQSYS [list]:
    SYSTEM
    USERS
      PERMANENT tablespace to use for PYQSYS [list]: SYSTEM
      TEMPORARY tablespace to use for PYQSYS [list]: TEMP
    
    Current configuration
      ORACLE_HOME ...................... /u01/app/oracle/product/19.3/dbhome_1
      ORACLE_SID ....................... orcl
      PDB .............................. ORCLPDB
      Python Version ................... 3.9.5
      PYTHONHOME ....................... /u01/app/oracle/product/19.3/dbhome_1/python
    
      Existing OML4P data and code ..... None
      Existing OML4P AutoML component .. None
      Existing OML4P embed component ... None
      Existing OML4P module version .... None
    
      PYQSYS PERMANENT tablespace ...... SYSTEM
      PYQSYS TEMPORARY tablespace ...... TEMP
    
      Operation ........................ Install/Upgrade
    
    Proceed? [yes]yes
    
    Copying embedded python libraries ... Pass
    Processing ./server/oml-1.0-cp39-cp39-linux_x86_64.whl
    Installing collected packages: oml
    Successfully installed oml-1.0
    Configuring the database ............ Pass
    
    Done

    An OML4Py user is a database user account that has privileges for performing machine learning activities. To learn more about how to create a user for Oracle Machine learning for python click Create New Users for On-Premises Oracle Database

Verify the Server Installation

You can verify the database configuration of OML4Py as oracle user by doing the following:
  1. On the OML4Py server database instance, start SQL*Plus as the OML user logging into the PDB, in this example, PDB1.
    $ sqlplus oml_user/oml_user_password$PDB1
  2. Run the following command:
    SELECT * FROM sys.pyq_config;
    The expected output is as follows:
    bash-4.4$ sqlplus / as sysdba;
    
    SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jan 31 12:49:34 2022
    Version 19.3.0.0.0
    
    Copyright (c) 1982, 2019, Oracle. All rights reserved.
    
    
    Connected to:
    Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
    Version 19.3.0.0.0
    
    SQL> alter session set container=PDB1;
    
    Session altered.
    
    SQL> select * from sys.pyq_config;
    
    NAME
    --------------------------------------------------------------------------------
    VALUE
    --------------------------------------------------------------------------------
    PYTHONHOME
    /u01/app/oracle/product/19.3/dbhome_1/python
    
    PYTHONPATH
    /u01/app/oracle/product/19.3/dbhome_1/oml4py/modules
    
    VERSION
    1.0
    
    
    NAME
    --------------------------------------------------------------------------------
    VALUE
    --------------------------------------------------------------------------------
    PLATFORM
    ODB
    
    DSWLIST
    oml.*;pandas.*;numpy.*;matplotlib.*;sklearn.*
  3. To verify the installation of the OML4Py server for an on-premises database see Verify OML4Py Server Installation for On-Premises Database.