Installing Python Packages

Sometimes additional packages are required to use the Python interface with your own scripts. To install these packages, Python offers its own package management system (pip).

In combination with the supplied command wrapper, the Python for optiSLang can be easily extended. To complete an installation for all users, you must have admin privileges.

To install the packages locally, use the following command line syntax:

[installation path]\optislang-python <args>

Examples:

Windows

> cd "[installation path]"

> optislang-python.cmd -m pip install -U matplotlib

Linux

> cd [installation path]

> optislang-python -m pip install -U matplotlib

To install the packages offline, or rolling them out in the local network:

  1. In a command prompt, download the packages for offline installation on a machine that can connect to the internet.

    If a single package is being installed, type:

    pip install <package> --download /tmp/offline_packages

    If you are installing a list of dependencies, type:

    pip install --download /tmp/offline_packages -r requirements.txt
  2. Transfer the downloaded packages to the target installation machine.

  3. Install the packages on the target machine.


    Note:  The following commands assume the /tmp/transferred_packages directory contains the contents of /tmp/offline_packages from the previous machine.


    If a single package is being installed, type:

    pip install --no-index --find-links="/tmp/transferred_packages" <package>

    If you are installing a list of dependencies, type:

    pip install --no-index --find-links="/tmp/transferred_packages" -r requirements.txt