Enable the Bridge between OML and Python on Linux
- Install/build Python 3.8.10 , Numpy 1.22.1, and scipy 1.6.1.
-
Enable omlpythonbridge toolbox loading.
Add the command loadtoolbox omlpythonbridge in the file <INSTALLATION_HOME>\OpenMatrix\scripts\loadtoolboxes.oml.
-
In the file
<INSTALLATION_HOME>\OpenMatrix\scripts\run_omlconsole.sh, add
the following:
-
Set the environment variable OML_PYTHONHOME to point to Python home.
export OML_PYTHONHOME=/usr/local/python3.8.10
-
Add the Python library file
(libpython3.8m.so.1.0) location to the environment variable
“LD_LIBRARY_PATH.”
export LD_LIBRARY_PATH=/usr/local/python3.8.10/lib:$LD_LIBRARY_PATH
-
Set the environment variable LD_PRELOAD to point to
libpython3.8.so.1.0.
export LD_PRELOAD=/usr/local/Python38/lib/libpython3.8.so.1.0
Note: omlpythonbridge toolbox is built using Python binaries, which are built using RedHat Linux 6.6 devtoolset-3 compilers, Intel 2016 Update 2 Fortran and C++ compilers. It is advised to use Python binaries built using the same compiler versions.Note: OpenMatrix binaries are built using RedHat Linux 6.6 devtoolset-3 compilers, Intel 2016 Update 2 Fortran and C++ compilers with:- Compilation Options: g++ -O2 -fPIC -std=c++11 -DLINUX -DOS_UNIX
- Link options: g++ -shared -Wl,-Bsymbolic –fPIC
Note: Verified omlpythonbridge toolbox using Python 3.8.10 built from source. Installed Numpy, Scipy, Matplotlib using pip.The steps to build Python and install modules for RedHat 8.4 are:
yum install zlib*
yum install openssl-devel
cd /opt
wget https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tgz
tar xzf Python-3.8.10.tgz
cd Python-3.8*/
./configure --enable-shared --prefix=/usr/local/python38
make altinstall
export LD_LIBRARY_PATH=/usr/local/python38/lib:$LD_LIBRARY_PATH
cd /usr/local/python38/bin
python3.8 -m pip install --upgrade pip
python3.8 -m pip install numpy==1.22.1
python3.8 -m pip install scipy==1.6.1
python3.8 -m pip install matplotlib==3.3.0
-
Set the environment variable OML_PYTHONHOME to point to Python home.