Installation¶
System Requirements¶
Can I check if everything is properly set up before I start?¶
MATLAB¶
Please ensure that you have a compatible and working MATLAB
installation.
The list of compatible solvers is available here.
No support is provided for versions older than R2014b.
MATLAB
is released on a twice-yearly schedule. After the latest release (version b),
it may be a couple of months before certain methods with dependencies
on other software become compatible. For example, the latest releases of MATLAB
may not be compatible with the existing solver interfaces,
necessitating an update of the MATLAB
interface provided by the solver developers,
or an update of the COBRA Toolbox, or both.
git¶
You can check if you have a working installation of git
by typing in
the Terminal
(on linux
and macOS
) or cmd
(in
Windows
, not Git Bash
):
$ git --version
If installed properly, this will return git version 2.13.1 [...]
or
similar with another version number.
curl¶
You can check if you have a working installation of curl
by typing
in the terminal (cmd
on Windows, not Git Bash
):
$ curl --version
which will return curl 7.51.0 [...]
or similar with another version
number if installed properly. If you encounter any issues with curl
, please
post in our .
What if my system is not properly configured?¶
Linux (Ubuntu or Debian)¶
$ sudo apt-get install git-all curl
There is a known issue on Matlab 2016b (or earlier) with a default library that is used to access web resources. Please have a look at the FAQ.
macOS¶
In order to install git
, install the Xcode Command Line
Tools.
For curl
, follow the instructions
here.
Download and installation¶
Download this repository (the folder
./cobratoolbox/
will be created). You can clone the repository using:$ git clone --depth=1 https://github.com/opencobra/cobratoolbox.git cobratoolbox
Please note the
--depth=1
in the clone command. Run this command inTerminal
(on and ) or inGit Bash
(on ) - not in . Although not recommended, you can download the repository as a compressed archive.Change to the folder
cobratoolbox/
and run from>> initCobraToolbox
Solver compatibility¶
Linux Ubuntu¶
SolverName | R2021b | R2021a | R2020b | R2020a |
---|---|---|---|---|
IBM CPLEX 20.10 | ||||
IBM CPLEX 12.10 | ||||
IBM CPLEX 12.8 | ||||
GUROBI 9.1.1 | ||||
TOMLAB CPLEX 8.6 | ||||
MOSEK 9.2 | ||||
GLPK | ||||
DQQ MINOS | ||||
PDCO |
macOS 10.13+¶
SolverName | R2021b | R2021a | R2020b | R2020a |
---|---|---|---|---|
IBM CPLEX 20.10 | ||||
IBM CPLEX 12.10 | ||||
IBM CPLEX 12.8 | ||||
GUROBI 9.1.1 | ||||
TOMLAB CPLEX 8.6 | ||||
MOSEK 9.2 | ||||
GLPK | ||||
DQQ MINOS | ||||
PDCO |
Windows 10¶
SolverName | R2021b | R2021a | R2020b | R2020a |
---|---|---|---|---|
IBM CPLEX 20.10 | ||||
IBM CPLEX 12.10 | ||||
IBM CPLEX 12.8 | ||||
GUROBI 9.1.1 | ||||
TOMLAB CPLEX 8.6 | ||||
MOSEK 9.2 | ||||
GLPK | ||||
DQQ MINOS | ||||
PDCO |
Legend
- : compatible with the COBRA Toolbox (tested)
- : not compatible with the COBRA Toolbox (tested)
- : possibly incompatibile with the COBRA Toolbox (problems reported)
Notes
- Make sure to install the correct Tomlab version for your version of
macOS
. Please note that there is a different Tomlab installer for MATLABR2017a+
. - Only actively supported interfaces are evaluated for compatibility.
- The
matlab
solver interface is compatible with all actively supported MATLAB versions. - The interfaces
cplex_direct
andtomlab_snopt
bear the same compatibility pattern astomlab_cplex
. - The interface
quadMinos
bears the same compatibility pattern asdqqMinos
. - The interface
lindo_old
bears the same compatibility pattern aslindo_legacy
.
Binaries and Compilers¶
For convenience, we provide
glpk_mex and
libSBML-5.17+ in
/external
.
Binaries for these libraries are provided in a submodule for Mac OS X 10.6 or later (64-bit), GNU/Linux Ubuntu 14.0+ (64-bit), and Microsoft Windows 7+ (64-bit). For unsupported OS, please refer to their respective building instructions (glpk_mex, libSBML).
Read more on the compatibility with SBML-FBCv2 here.
Solver installation¶
Please make sure that you install a compatible solver. Check the compatibility here.
Platform-specific instructions are marked with
- Windows -
- macOS -
- linux -
Most steps require superuser or administrator rights (sudo
).
Make sure that you replace <ver>
with the respective
version
of the installed solver when setting the environment
variables.
TOMLAB¶
Download
TOMLAB/CPLEX
from here, where you can also downloadTOMLAB/SNOPT
. You must purchase thetomlab.lic
license separately.In a terminal window, navigate to the download directory of
Tomlab
and do the following:$ chmod +x <filename>.bin $ sudo ./<filename>.bin
Run the
tomlab-win64-setup_<ver>.exe
as an administrator.Double-click on
tomlab-osx64-setup.app
.Follow the installation instructions and install
tomlab
in:- :
/opt
such that you will have a folder/opt/tomlab
. - :
C:\
such that you will have a folderC:\tomlab
. - :
/Applications
such that you will have a folder/Applications/tomlab
.
- :
Copy the
tomlab.lic
license to the folder/opt/tomlab
and change its permissions (you must have superuser orsudo
rights):$ sudo chmod 644 tomlab.lic
Copy the
tomlab.lic
license to the folderC:\tomlab
. Copy thetomlab.lic
license to the folder/Applications/tomlab
.Set the environment variable by editing your
~/.bashrc
file:$ nano ~/.bashrc
Append the following lines, hit the
ESC
key, then save and exit by typingCTRL-X
and hittingENTER
:export TOMLAB_PATH="/opt/tomlab"
Reload your
~/.bashrc
:$ source ~/.bashrc
In order to set the environment variables on Windows, please follow the instructions here.
IBM ILOG CPLEX¶
Download the
CPLEX
installation binary. The limited community edition is here. CPLEX is free for students (and academics) and further information how to register and download is here.Add
execute
permission to binary$ chmod +x <cplexbinary>.bin
Run the installer binary as superuser, follow the installation procedure, and accept the default installation path.
$ sudo ./<cplexbinary>.bin
Run
cplex_studio<ver>.win-x86-64.exe
as an administrator. Follow the installation instructions and installCPLEX
inC:\Program Files\IBM\ILOG\CPLEX_Studio<ver>
.Set the environment variable by editing your
~/.bashrc
file:$ nano ~/.bashrc
Append the following lines, hit the
ESC
key, then save and exit by typingCTRL-X
and hittingENTER
.On :
export ILOG_CPLEX_PATH="/opt/ibm/ILOG/CPLEX_Studio<ver>"
On :
export ILOG_CPLEX_PATH="/Applications/IBM/ILOG/CPLEX_Studio<ver>"
Reload your
~/.bashrc
:$ source ~/.bashrc
Make sure that you select
Yes, update the PATH variable.
. You can also follow the instructions here.If you installed cplex in a non default folder (or if you are using the community version) please make sure, that you create an environment variable
ILOG_CPLEX_PATH
pointing to the directory containing the CPLEX matlab bindings. This can also be done by creating a startup.m file as detailed here here. In this startup file add the following command:setenv('ILOG_CPLEX_PATH','C:\<yourCPLEXPath>\CPLEX_Studio<ver>\cplex\matlab\<arch>')
where<yourCPLEXPath>
is the path to cplex,<ver>
is the installed version and<arch>
is the architecture identifier.
GUROBI¶
Register and log in here
Request license from the download center and retrieve
YOUR-LICENSE-KEY-FROM-SITE
Download the
Gurobi
optimizer from hereNavigate to the directory where
Gurobi
was downloaded and enter$ tar -xvzf <archive>.tar.gz $ sudo mv gurobi<ver> /opt/. $ cd /opt/gurobi<ver>/linux64/bin/
Run
Gurobi-<ver>-win64.msi
and follow the installation instructions. Accept the default pathC:\gurobi<ver>\
.Run
gurobi<ver>_mac64.pkg
and follow the installation instructions. Accept the default path/Applications/gurobi<ver>/
.Edit the
bash
settings to include paths$ nano ~/.bashrc
Append the following lines, hit the
ESC
key, then save and exit by typingCTRL-X
and hittingENTER
:export GUROBI_HOME="/opt/gurobi<ver>/linux64" export PATH="${PATH}:${GUROBI_HOME}/bin" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib" export GUROBI_PATH="${GUROBI_HOME}"
Reload your
~/.bashrc
:$ source ~/.bashrc
In order to set the environment variables on Windows, please follow the instructions here.
Activate your license by running:
$ grbgetkey YOUR-LICENSE-KEY-FROM-SITE
You will be prompted
In which directory would you like to store the Gurobi license key file? [hit Enter to store it in /home/<userid>]:
Hit
ENTER
.Browse to
Start > All Programs > Gurobi < VER> > Gurobi Interactive Shell (<ver>)
. This should prompt to enter the license keyYOUR-LICENSE-KEY-FROM-SITE
. Enter this key and hiterENTER
.Verify that
Gurobi
is successfully installed by launching theGurobi
prompt:$ gurobi.sh
Browse to
Start > All Programs > Gurobi < VER> > Gurobi Interactive Shell (<ver>)
.Browse to
/Applications
and double-click onGurobi<ver>
to start the Gurobi shell.This command should give you the prompt for
Gurobi
. Exit by enteringexit()
or hittingCTRL-D
on your keyboard.
MOSEK¶
Download
MOSEK
as an archive hereApply for a license here. A free academic license is here. You will receive an email with your
mosek.lic
file.Save (or move) the downloaded archive
tar.bz2
to/opt/.
(you must have superuser orsudo
rights). Save (or move) the downloaded archivetar.bz2
to/Applications/.
(you must have superuser orsudo
rights).Navigate to
/opt
and extract the archivecd /opt $ tar xvjf <filename>.tar.bz2
Run
moseksetupwin64x86.msi
and selectTypical
installation. This will installmosek
inC:\Program Files\Mosek
.Browse to
/Applications
and double-click the archive to uncompress. It is important to run the scriptpython /Applications/mosek/<ver>/tools/platform/osx64x86/bin/install.py
, which makes important updates to the installation.Configure the
PATH
andMOSEKLM_LICENSE_FILE
environment variables in~/.bashrc
by editing yourbashrc
file$ nano ~/.bashrc
Append the following lines, hit the
ESC
key, then save and exit by typingCTRL-X
and hittingENTER
.On
export PATH=/opt/mosek/<ver>/:$PATH export MOSEKLM_LICENSE_FILE=/opt/mosek/
On
export MOSEK_PATH=/Applications/mosek/<ver>
export MOSEK_PATH=*YOUR*PATH*/mosektoolslinux64x86/mosek/10.1/toolbox/r2017a; export PATH=$MOSEK_PATH:$PATH export MOSEKLM_LICENSE_FILE=/Applications/mosek/
Reload your
~/.bashrc
:$ source ~/.bashrc
In order to set the environment variables on Windows, please follow the instructions here.
Copy the license file
mosek.lic
to/opt/mosek/
. Copy the license filemosek.lic
toC:\Users\<yourUsername>\mosek\
. Copy the license filemosek.lic
to/Applications/mosek/
.Verify that
MOSEK
is correctly installed by using the following command in your terminal$ /opt/mosek/<ver>/tools/platform/linux64x86/bin/./msktestlic
This command should give an output similar to this:
Problem Name : Objective sense : min Type : LO (linear optimization problem) Constraints : 1 Cones : 0 Scalar variables : 5000 Matrix variables : 0 Integer variables : 0 Optimizer started. Mosek license manager: License path: /opt/mosek/mosek.lic Mosek license manager: Checkout license feature 'PTS' from flexlm. Mosek license manager: Checkout time 0.01. r: 0 status: 0 Interior-point optimizer started. Presolve started. Eliminator started. Freed constraints in eliminator : 0 Eliminator terminated. Eliminator - tries : 1 time : 0.00 Lin. dep. - tries : 0 time : 0.00 Lin. dep. - number : 0 Presolve terminated. Time: 0.00 Interior-point optimizer terminated. Time: 0.00. Optimizer terminated. Time: 0.02 ************************************ A license was checked out correctly. ************************************
By browsing to Start > All Programs > Mosek Optimization Tools, you can run Test license system. This should open a window and display the output as shown above.
In a terminal, run:
$ /Applications/mosek//tools/platform/osx64x86/bin/./msktestlic
This should produce an output as shown above.
Test the installation¶
You may test your installation by running from
>> testAll
If you need support, please feel free to post your question in our .