cobrapy
cobrapy copied to clipboard
cplex or gurobi to solve the model
Problem description
Please explain: Hello! Please I'm trying to solve a model using cplex or gurobi as a solver for pFBA but it doesn't work ? Do you have any suggestions please?
Code Sample
Create a minimal, complete, verifiable example.

Context

Make sure that you can import cplex or import gurobi without error and create an optimization model for each.
Can you tell me please how to import cplex for free ? or maybe a link which explain how to do this ?
You have to apply for a license for Gurobi and/or CPLEX. Both have academic licensing options so if are affiliated with an institute you should be able to get access to a free license. There are some limitations in problem size in later versions as far as I recall, but for simple genome scale models these licenses should work without issue.
If you have the license you have to install the respective python packages and check that you can import them in the python environment you use with cobrapy
For more information see https://community.ibm.com/community/user/datascience/blogs/xavier-nodet1/2020/07/09/cplex-free-for-students https://www.ibm.com/products/ilog-cplex-optimization-studio/pricing (there is a link, get the no cost academic version) https://www.gurobi.com/academia/academic-program-and-licenses/
my model is huge it's with more 200.000 reactions and more than 100.000 metabolites. Do you think if I will take the academic license it will be able to solve my model . Because I'm facing a problem with glpk , it said that the model is infeasible ? Any solution please to solve the model ?
It should be possible. I am not sure about the size restrictions, I just remember vaguely that @cdiener mentioned this at some point in a comment. Must likely this will just work. Just google the limitations of the academic licenses or just try if it works ;)
The size restrictions only apply to the community versions (the ones that do not require a license). The academic license versions have no size restrictions. There are some instructions on how to install those in the MICOM docs, but like @matthiaskoenig said you first need to acquire a license.
Unfortunately, models of that size are always somewhat problematic because of numerical issues. It took me months to find strategies that worked for MICOM and it still isn't perfectly stable.
Hello, I am new at this and have been trying to switch to the gurobi solver, I installed with pip installs and when I run import gurobi there is no error. Also, when I run import optlang.gurobi_interface as grb is don't get an error either. However, when I run model.solver="gurobi" I get the SolverNotFound error. Could you please help me figure out how to solve this error?