--- id: cobra version: "0.32.1" license: LGPL-2.0-or-later OR GPL-2.0-or-later license_treatment: copyleft maintenance: active --- # cobra — COBRApy is a package for constraint-based modeling of metabolic networks. License: copyleft · Maintenance: active · Downloads: 91.1K/mo ## What it is and what it does COBRApy is a Python framework for building and analyzing constraint-based models of metabolic networks at genome scale. It provides infrastructure for creating metabolic models, managing reactions and metabolites, and accessing mathematical solvers (CPLEX, Gurobi, GLPK) through the optlang interface. The package implements standard COBRA methods including flux balance analysis (FBA), flux variability analysis (FVA), and gene deletion simulations to predict metabolic behavior and gene essentiality. The package is designed as both a standalone tool and a foundation for building specialized COBRA-related Python packages. It depends on numpy for numerical computation, pandas for data manipulation, pydantic for model validation, and python-libsbml for reading SBML model files. Solvers are accessed through optlang, with GLPK automatically available via swiglpk. The package targets researchers in systems biology, metabolic engineering, and computational biology who need to model and analyze organism metabolism at scale. Use it for: - Predict metabolic flux distributions and growth rates under different nutrient conditions using flux balance analysis. - Identify essential genes by simulating single and multiple gene knockouts to assess impact on growth. - Perform flux variability analysis to determine the range of possible reaction rates consistent with optimal growth. - Load, modify, and validate genome-scale metabolic models in SBML format for strain design workflows. - Build custom analysis pipelines by extending COBRApy classes for domain-specific metabolic research. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. COBRApy is a constraint-based modeling package for genome-scale metabolic network analysis, providing flux balance analysis, flux variability analysis, gene deletion analysis, and access to mathematical solvers. Yes. COBRApy is production-stable (active maintenance, release 3 days old, 579 GitHub stars) with low install friction and no known vulnerabilities. The dual GPL/LGPL copyleft license requires source disclosure but is standard for academic bioinformatics. Install if you need genome-scale metabolic modeling; the twelve runtime dependencies are justified by the package's scope and are well-maintained. ## Install pip install cobra uv add cobra poetry add cobra ## Installing cobra Before you install: Low install friction with a pure-wheel distribution. Active maintenance with a release 3 days old and recent commits. Twelve runtime dependencies including numpy, pandas, optlang, and swiglpk introduce some complexity, but the package is production-stable. License in practice: Dual-licensed under LGPL-2.0-or-later or GPL-2.0-or-later (copyleft). You may choose which license to use, but either choice requires source disclosure and derivative work licensing under the same terms. Quickstart: pip install cobra import cobra model = cobra.io.read_sbml_model('model.xml') solution = model.optimize() Requires a compatible mathematical solver (CPLEX, Gurobi, or GLPK via swiglpk) to be installed or configured for optimization to work. Verify before relying: - Whether all 12 runtime dependencies are required for basic usage or only for specific features (e.g., array support for MATLAB models). - Performance characteristics and scalability limits for large genome-scale models. - Compatibility with specific solver versions beyond the general optlang interface. ## Package facts - License: LGPL-2.0-or-later OR GPL-2.0-or-later (copyleft) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 91.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags metabolic network modeling, flux balance analysis, constraint-based reconstruction, genome-scale metabolism, FBA optimization, gene knockout analysis, metabolic pathway simulation, systems-biology, metabolic-modeling, constraint-optimization [View on SkillFed](https://skillfed.io/packages/cobra) · [View on PyPI](https://pypi.org/project/cobra/)