Installation

RBApy can be installed with Python 2.7 and Python 3.5 (or any later version compatible with the cplex package).

1. Install Python

If Python is not installed on your own computer, you need to install it. Go to the website https://www.python.org/downloads/. Download the appropriate python release for your system and install it.

2. Install CPLEX

IBM® CPLEX is an optimization software package. RBApy uses this package for the generation and checking of feasibility of the Linear Programming (LP) problem. CPLEX requires a licence to run, and one can be obtained for free if you have an academic email address. This you can do as follows:

After you have successfuly downloaded the package you need to install it and setup the Python API.

2.1. On Unix systems

Open a terminal, navigate to executable and run following commands (make sure to adapt the executable name if necessary):

chmod u+x cplex_studio12.7.1.osx.bin 
./cplex_studio12.7.1.osx.bin 

Make sure to remember CPLEX's installation path, as we need to navigate to it to setup the Python API. Go to the directory where CPLEX is installed, then go the sub-directory named python.

cd Path/To/Cplex/cplex/python/x86-64_linux
In this directory you should find a file setup.py. Be sure that you have administrator permissions, then set up the Python API by typing in the terminal:

python setup.py install

or

sudo python setup.py install

You can check that CPLEX was correctly installed by running:

python
import cplex

2.2 On Windows systems

Open the navigator, navigate to the location of the CPLEX installer and run it. Make sure to remember CPLEX's installation path, as we will need to navigate to it to set up the Python API.
Then open a batch console with administrative permissions. Go to the directory where CPLEX is installed, then go the sub-directory named python.

cd Path\To\Cplex\cplex\python\x64_win64

A file named setup.py should be present. Set up the Python API by typing in the console (Adapt the following line to the version of Python and to the Python path on your computer).

Path\To\Python\python.exe setup.py install

You can check that CPLEX was correctly installed by running:

Path\To\Python\python.exe
import cplex

2.3 On MAC systems

Open a terminal, navigate to executable and run following commands (make sure to adapt the executable name if necessary):

chmod u+x cplex_studio12.7.1.osx.bin 
./cplex_studio12.7.1.osx.bin 

Do remember the installation path of CPLEX, as we will need to navigate to it to set up the Python API. Go to the directory where CPLEX is installed, then go the sub-directory named python. A file named setup.py should be present. Be sure that you have administrator permissions, then set up the Python API by typing

python setup.py install

Here is an example with a default Mac installation, cplex 12.7 and python3.5:

cd /Users/my_username/Applications/IBM/ILOG/CPLEX_Studio1271/cplex/python/3.5/x86-64_osx
python setup.py install
# alternative: install to custom location
python setup.py install --home yourPythonPackageshome/cplex

You can check that CPLEX was correctly installed by running:

python
import cplex

3. Install RBApy package

We recommend that you use the stable relase of the RBApy package which you can download from our github page, and find under the tab Releases. Alternatively, if you wish to clone the repository, make sure you checkout the commit containing the tag referencing the latest release, as shown:

git clone https://github.com/SysBioInra/RBApy
cd RBApy
git checkout tags/v1.0

Navigate to the directory containing RBApy, be sure that you have administrator permissions and install it by typing:
On UNIX and MAC systems,

cd path/to/rbapy/package
python setup.py install

On Windows systems,

cd path\to\rbapy\package
Path\To\Python\python.exe setup.py install

The Path\To\Python should be replaced by a Python installation path valid on your computer.

This step may take some time, as it will install missing dependencies.

((NOTE: RBApy needs scipy<=1.2.1, so check that you have the appropriate version installed. This issue arose because the latest scipy version (1.3.0) introduced some changes which are not yet supported by RBApy, but should be in near future.))

After this step is finished, you can check that RBApy was correctly installed by running:

python
import rba

or for Windows systems

Path\To\Python\python.exe
import rba