Enable the Bridge between OML and Python on Linux

  1. Install/build Python 3.5.2 , Numpy 1.14.5.
  2. Enable omlpythonbridge toolbox loading.
    Add the command loadtoolbox omlpythonbridge in the file <INSTALLATION_HOME>\OpenMatrix\scripts\loadtoolboxes.oml.
  3. In file <INSTALLATION_HOME>\OpenMatrix\scripts\run_omlconsole.sh, adapt the .sh file to specific paths on your machine by adding the following:
    1. Set the environment variable OML_PYTHONHOME to point to Python home.
      export OML_PYTHONHOME=/usr/local/python3.5.2
    2. Add the Python library file (libpython3.5m.so.1.0) location to the environment variable “LD_LIBRARY_PATH”
      LD_LIBRARY_PATH=/usr/local/python3.5.2/lib:$LD_LIBRARY_PATH
    Note: omlpythonbridge toolbox 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 same compiler versions.
    Note: OpenMatrix binaries 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.5.2 built from source. Installed Numpy, Scipy, Matplotlib using pip. The steps (may vary) are:
    CentOS 6.6

    cd /opt

    wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz

    tar xzf Python-3.5.2.tgz

    cd Python-3.5.2

    ./configure --enable-shared --prefix=/usr/local/python352

    make altinstall

    export LD_LIBRARY_PATH=/usr/local/python352/lib:$LD_LIBRARY_PATH

    cd /usr/local/python352/bin

    python3.5 -m pip install --upgrade pip

    python3.5 -m pip install numpy==1.14.5

    python3.5 -m pip install scipy==1.1.0

    python3.5 -m pip install matplotlib==2.2.2

    CentOS 7.2

    yum install zlib*

    yum install openssl-devel

    yum install tkinter tk-devel

    cd /opt

    wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz

    tar xzf Python-3.5.2.tgz

    cd Python-3.5.2

    ./configure --enable-shared --prefix=/usr/local/python352

    make altinstall

    export LD_LIBRARY_PATH=/usr/local/python352/lib:$LD_LIBRARY_PATH

    cd /usr/local/python352/bin

    python3.5 -m pip install --upgrade pip

    python3.5 -m pip install numpy==1.14.5

    python3.5 -m pip install scipy==1.1.0

    python3.5 -m pip install matplotlib=2.2.2