4.4.1 Install OML4Py Server for Linux for On-Premises Oracle Database 23ai

Instructions for installing the OML4Py server for Linux for an on-premises Oracle Database 23ai.

You can install OML4Py by using a Python script included in your 23ai database or by using the Database Configuration Assistant (DBCA).

Install OML4Py Using a SQL Script

To install the on-premises OML4Py server, the following are required:
  • A connection to the internet.
  • 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 perl-Env package. You can install the package as root with the command yum install perl-Env .

    To check for the existence of perl-Env, run the following command. The version will vary depending on your Operating System and version:

    rpm -qa perl-Env
    perl-Env-1.04-395.el8.noarch
  • Write permission on the directories to which you download and install the server components.

Note:

The following environment variables must be set up.
  • Set environment variables: Set PYTHONHOME and add it to your PATH
  • Set ORACLE_HOME and add it to your PATH
  • Set LD_LIBRARY_PATH
export PYTHONHOME=$ORACLE_HOME/python
export PATH=$PYTHONHOME/bin:$ORACLE_HOME/bin:$PATH
export ORACLE_HOME=<ORACLE_HOME PATH>
export LD_LIBRARY_PATH=$PYTHONHOME/lib:$ORACLE_HOME/lib:$LD_LIBRARY_PATH

To install the OML4Py server for Linux for an on-premises Oracle Database 23ai, run the server installation SQL script pyqcfg.sql.

Note:

The OML4Py server needs to be installed on CDB$ROOT first, followed by installation on a PDB for Oracle Database 23ai.
  1. The pyqcfg.sql script is under $ORACLE_HOME/oml4py/server. Change directory to $ORACLE_HOME/oml4py/server.

    cd $ORACLE_HOME/oml4py/server
  2. At your operating system prompt, start SQL*Plus, connect to the CDB$ROOT and run the pyqcfg.sql script.

    sqlplus / as sysdba
    SQL*Plus: Release 23.0.0.0.0 - Production on Tue Apr 30 12:40:18 2024
    Version 23.4.0.24.05
    
    Copyright (c) 1982, 2024, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 23ai Enterprise Edition Release 23.0.0.0.0 - Production
    Version 23.4.0.24.05

    To capture the log, spool the installation steps to an external file install_root.txt.

    SQL> spool install_root.txt

    Verify that you are currently connected to the CDB$ROOT container.

    SQL> show con_name
    
    CON_NAME
    ------------------------------
    CDB$ROOT

    Run the pyqcfg.sql script to install OML4Py server in the CDB$ROOT first.

    SQL> @pyqcfg.sql SYSAUX TEMP
    
    SQL> spool off;
    where
    • SYSAUX is the permanent tablespace for the PYQSYS schema.
    • TEMP is the temporary tablespace for the PYQSYS schema.

    Open the install_root.txt file to see if any errors occurred.

  3. At your operating system prompt, start SQL*Plus, connect to your PDB and run the pyqcfg.sql script. To capture the log, spool the installation steps to an external file install_pdb.txt. The following example uses the PDB ORCLPDB and gives example values for the script arguments.

    sqlplus / as sysdba
    
    SQL> spool install_pdb.txt

    Log into a PDB where you want to install OML4Py server.

    SQL> alter session set container=ORCLPDB;
    Run the pyqcfg.sql script to install OML4Py server in the PDB.
    SQL> @pyqcfg.sql SYSAUX TEMP
    
    SQL> spool off;
    where
    • SYSAUX is the permanent tablespace for the PYQSYS schema.
    • TEMP is the temporary tablespace for the PYQSYS schema.

    Open the install_pdb.txt file to see if any errors occurred

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$ORCLPDB
  2. Run the following command:
    SELECT * FROM sys.pyq_config;
    The expected output is as follows:
    $ sqlplus / as sysdba;
    SQL*Plus: Release 23.0.0.0.0 - Production on Tue Apr 30 16:23:35 2024
    
    
    Copyright (c) 1982, 2024, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 23ai Enterprise Edition Release 23.0.0.0.0 - Production
    Version 23.4.0.24.05
    
    SQL> alter session set container=ORCLPDB;
    
    Session altered.
    
    SQL> select * from sys.pyq_config;
    
    NAME
    --------------------------------------------------------------------------------
    VALUE
    --------------------------------------------------------------------------------
    PYTHONHOME
    /u01/app/oracle/product/23.4.0.0/dbhome_1/python
    
    PYTHONPATH
    /u01/app/oracle/product/23.4.0.0/dbhome_1/oml4y/modules
    
    VERSION
    2.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 Installation for On-Premises Database.