opencobra / cobrapy

COBRApy is a package for constraint-based modeling of metabolic networks.
http://opencobra.github.io/cobrapy/
GNU General Public License v2.0
468 stars 218 forks source link

[BUG] Using cobra.io.load_matlab_model with gurobi 12 is incompatible #1413

Closed cjrodriguez98 closed 1 week ago

cjrodriguez98 commented 1 week ago

Is there an existing issue for this?

Problem description

File "/scratch/cjrodriguezf/enviroments/cycles/lib/python3.9/site-packages/cobra/core/model.py", line 1017, in variables return self.solver.variables File "/scratch/cjrodriguezf/enviroments/cycles/lib/python3.9/site-packages/optlang/interface.py", line 1239, in variables self.update() File "/scratch/cjrodriguezf/enviroments/cycles/lib/python3.9/site-packages/optlang/gurobi_interface.py", line 666, in update super(Model, self).update(callback=self.problem.update) File "/scratch/cjrodriguezf/enviroments/cycles/lib/python3.9/site-packages/optlang/interface.py", line 1464, in update self._add_constraints(add_constr) File "/scratch/cjrodriguezf/enviroments/cycles/lib/python3.9/site-packages/optlang/gurobi_interface.py", line 723, in _add_constraints self.problem.addConstr(lhs, sense, rhs, name=constraint.name) File "src/gurobipy/_model.pyx", line 3894, in gurobipy._model.Model.addConstr TypeError: addConstr() takes at most 3 positional arguments (4 given)

Code sample

Code run:

toy_model = load_matlab_model(Path(/path/path/path', 'toy_model.mat'))

Traceback:

Environment

### Package Information | Package | Version | |:--------|--------:| | cobra | 0.29.0 | ### Dependency Information | Package | Version | |:--------------------|------------:| | appdirs | 1.4.4 | | black | **missing** | | bumpversion | **missing** | | depinfo | 2.2.0 | | diskcache | 5.6.3 | | future | 1.0.0 | | httpx | 0.27.2 | | importlib-resources | 6.4.5 | | isort | **missing** | | numpy | 1.26.4 | | optlang | 1.8.2 | | pandas | 2.2.2 | | pydantic | 2.9.1 | | python-libsbml | 5.20.4 | | rich | 13.8.1 | | ruamel.yaml | 0.18.6 | | scipy | 1.13.1 | | swiglpk | 5.0.10 | | tox | **missing** | ### Build Tools Information | Package | Version | |:-----------|--------:| | pip | 24.0 | | setuptools | 70.1.1 | | wheel | 0.43.0 | ### Platform Information | | | |:--------|---------:| | Windows | 10-AMD64 | | CPython | 3.9.19 |

Anything else?

No response

Midnighter commented 1 week ago

This is the same issue as https://github.com/opencobra/optlang/issues/273 reported on optlang. It has been fixed but not released yet.