#Installation of cobrapy
For installation help, please use the Google Group. For usage instructions, please see the documentation.
All releases require Python 2.7+ or 3.4+ to be installed before proceeding. Mac OS X (10.7+) and Ubuntu ship with Python. Windows users without python can download and install python from the python website. Please note that though Anaconda and other python distributions may work with cobrapy, they are not explicitly supported (yet!).
cobrapy can be installed with any recent installation of pip. Instructions for several operating systems are below:
- install pip.
- In a terminal, run
sudo pip install cobra
The preferred installation method on Windows is also to use pip. The latest Windows installers for Python 2.7 and 3.4 include pip, so if you use those you will already have pip.
- In a terminal, run
C:\Python27\Scripts\pip.exe install cobra
(you may need to adjust the path accordingly).
To install without pip, you will need to download and use the appropriate installer for your version of python from the python package index.
Use pip to install Cython. Install libglpk
using your package manger. This would be
brew install homebrew/science/glpk
on a Mac
and sudo apt-get install libglpk-dev
on debian-based systems
(including Ubuntu and Mint). GLPK can also be compiled from the
released source.
Clone the git repository using your preferred mothod. Cloning from your own github fork is recommended! Afterwards, open a terminal, enter the cobrapy repository and run the following command:
python setup.py develop --user
On windows, these can downloaded from [this site] (http://www.lfd.uci.edu/~gohlke/pythonlibs/). On Mac/Linux, they can be installed using pip, or from the OS package manager (e.g brew, apt, yum).
- libsbml >= 5.10 to read/write SBML level 2 files
- Windows installer
- Use
sudo pip install python-libsbml
on Mac/Linux
- lxml to speed up read/write of SBML level 3 files.
- numpy >= 1.6.1 for double deletions
- scipy >= 0.11 for ArrayBasedModel and saving to *.mat files.
cobrapy comes with bindings to the GNU Linear Programming Kit ([glpk] (http://www.gnu.org/software/glpk/)) using its own bindings called "cglpk" in cobrapy. In addition, cobrapy currently supports these linear programming solvers:
- ILOG/CPLEX (available with Academic and Commercial licenses).
- gurobi
- QSopt_ex esolver
- MOSEK
- coin-or clp and cbc through cylp.
ILOG/CPLEX, MOSEK, and Gurobi are commercial software packages that currently provide free licenses for academics and support both linear and quadratic programming. GLPK and clp are open source linear programming solvers; however, they may not be as robsut as the commercial solvers for mixed-integer and quadratic programming. QSopt_ex esolver is also open source, and can solve linear programs using rational operations, giving exact solutions.
- Start python
- Type the following into the Python shell
from cobra.test import test_all
test_all()
You should see some skipped tests and expected failures, and the function should return False
.