opencobra / cobrapy

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

cobra.exceptions.OptimizationError: Solver status is 'undefined'. TypeError: cannot pickle 'SwigPyObject' object #1287

Closed helehera closed 2 years ago

helehera commented 2 years ago

import cobra model = cobra.io.read_sbml_model('Output.xml') print(model.metabolites[:3]) print(type(model.solver)) model.solver = 'glpk' blocked = cobra.flux_analysis.find_blocked_reactions(model) print(blocked)

[<Metabolite MAM10620ve2 at 0x7ff899d47358>, <Metabolite MAM10620sf3 at 0x7ff899d47320>, <Metabolite MAM10620sg6 at 0x7ff899d47470>] <class 'optlang.glpk_interface.Model'> cobra.exceptions.OptimizationError: Solver status is 'undefined'.

import cobra model = cobra.io.read_sbml_model('Output.xml') print(model.metabolites[:3]) print(type(model.solver)) blocked = cobra.flux_analysis.find_blocked_reactions(model) print(blocked)

[<Metabolite MAM10620ve2 at 0x7ff899d47358>, <Metabolite MAM10620sf3 at 0x7ff899d47320>, <Metabolite MAM10620sg6 at 0x7ff899d47470>] <class 'optlang.glpk_interface.Model'> cobra.exceptions.OptimizationError: Solver status is 'undefined'.

Does everyone know how I can solve this issue?

helehera commented 2 years ago

On a different machine:

import cobra model = cobra.io.read_sbml_model('Output.xml') blocked = cobra.flux_analysis.find_blocked_reactions(model) TypeError: cannot pickle 'SwigPyObject' object