You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I was attempting to run the troppo tutorial on GIMME to make sure everything worked fine and first:
The solver CPLEX does not seem to exist, so I used the GLPK (out of two: GLPK or SCIPY). Unsure if it's relevant for the following issue but:
In gimme.run a typeError occured:
File ~/anaconda3/lib/python3.9/site-packages/troppo/methods/reconstruction/gimme.py:289, in GIMME.run(self)
280 def run(self):
281 """
282 Run GIMME algorithm
283
(...)
287
288 """
--> 289 sol = self.gm.optimize_gimme(
290 exp_vector=self.properties['exp_vector'],
291 objectives=self.properties['objectives'],
292 obj_frac=self.properties['obj_frac'],
293 flux_thres=self.properties['flux_threshold']
294 )
295 self.sol = sol
296 return sol.get_reaction_activity(self.properties['flux_threshold'])
File ~/anaconda3/lib/python3.9/site-packages/troppo/methods/reconstruction/gimme.py:107, in GIMMEModel.optimize_gimme(self, exp_vector, objectives, obj_frac, flux_thres)
104 for idx, lb in zip(objective_ids, lbs_id):
105 self.set_reaction_bounds(idx, lb=lb, temporary=True)
--> 107 self.set_objective(gimme_model_objective, True)
108 sol = self.optimize()
109 self.revert_to_original_bounds()
File ~/anaconda3/lib/python3.9/site-packages/cobamp/core/models.py:566, in ConstraintBasedModel.set_objective(self, coef_dict, minimize)
564 self.model.set_objective(self.c, minimize)
565 elif isinstance(coef_dict, ndarray):
--> 566 self.model.set_objective(coef_dict, minimize)
567 else:
568 raise TypeError('coef_dict must either be a dict or an ndarray')
File ~/anaconda3/lib/python3.9/site-packages/cobamp/core/linear_systems.py:474, in LinearSystem.set_objective(self, coefficients, minimize, vars)
472 self.model.remove(dummy)
473 self.model.objective.direction = SENSE_MINIMIZE if minimize else SENSE_MAXIMIZE
--> 474 self.model.update()
File ~/anaconda3/lib/python3.9/site-packages/optlang/glpk_interface.py:753, in Model._remove_variables(self, variables)
751 num = intArray(len(variables) + 1)
752 for i, variable in enumerate(variables):
--> 753 num[i + 1] = variable._index
754 glp_del_cols(self.problem, len(variables), num)
756 for variable in variables:
TypeError: in method 'intArray___setitem__', argument 3 of type 'int' `
I only altered the solver and I'm unsure why this error would occur? I'm unsure of how I can solve this I've experimented a bit but got stuck.
Of note I had some trouble with another environment Troppo package where the GIMMEproperties did not have all the current arguments (i.e. solver), could this be similar installation problem despite having worked well up until this point?
Thanks in advance!
Edit:
I tried to install troppo in Google Colab and see if it's a problem from my Anaconda installation. What happened is that the in the Solver CPLEX still didn't exist, GLPK still made the same TypeError but I had the option of using SCIPY or OSQP (one more than in my installed environments).
OSQP did in fact finish the model! (SciPy was taking too long so I had to kill it). So it may be a problem with the GLPK solver itself for some reason?
Edir 2:
Tried the iMAT and a TypeError also happens there (this one ">=" not supported between instances of 'list' and 'float') again, I changed nothing of the script except location of files.
The text was updated successfully, but these errors were encountered:
Hello! I was attempting to run the troppo tutorial on GIMME to make sure everything worked fine and first:
The solver CPLEX does not seem to exist, so I used the GLPK (out of two: GLPK or SCIPY). Unsure if it's relevant for the following issue but:
In gimme.run a typeError occured:
` ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[9], line 12
9 # Run the GIMME algorithm.
10 gimme = GIMME(S=model_wrapper.S, lb=model_wrapper.lb, ub=model_wrapper.ub, properties=properties)
---> 12 model_gimme = gimme.run()
14 print(model_gimme)
File ~/anaconda3/lib/python3.9/site-packages/troppo/methods/reconstruction/gimme.py:289, in GIMME.run(self)
280 def run(self):
281 """
282 Run GIMME algorithm
283
(...)
287
288 """
--> 289 sol = self.gm.optimize_gimme(
290 exp_vector=self.properties['exp_vector'],
291 objectives=self.properties['objectives'],
292 obj_frac=self.properties['obj_frac'],
293 flux_thres=self.properties['flux_threshold']
294 )
295 self.sol = sol
296 return sol.get_reaction_activity(self.properties['flux_threshold'])
File ~/anaconda3/lib/python3.9/site-packages/troppo/methods/reconstruction/gimme.py:107, in GIMMEModel.optimize_gimme(self, exp_vector, objectives, obj_frac, flux_thres)
104 for idx, lb in zip(objective_ids, lbs_id):
105 self.set_reaction_bounds(idx, lb=lb, temporary=True)
--> 107 self.set_objective(gimme_model_objective, True)
108 sol = self.optimize()
109 self.revert_to_original_bounds()
File ~/anaconda3/lib/python3.9/site-packages/cobamp/core/models.py:566, in ConstraintBasedModel.set_objective(self, coef_dict, minimize)
564 self.model.set_objective(self.c, minimize)
565 elif isinstance(coef_dict, ndarray):
--> 566 self.model.set_objective(coef_dict, minimize)
567 else:
568 raise TypeError('
coef_dict
must either be a dict or an ndarray')File ~/anaconda3/lib/python3.9/site-packages/cobamp/core/linear_systems.py:474, in LinearSystem.set_objective(self, coefficients, minimize, vars)
472 self.model.remove(dummy)
473 self.model.objective.direction = SENSE_MINIMIZE if minimize else SENSE_MAXIMIZE
--> 474 self.model.update()
File ~/anaconda3/lib/python3.9/site-packages/optlang/interface.py:1491, in Model.update(self, callback)
1489 rm_var = self._pending_modifications.rm_var
1490 if len(rm_var) > 0:
-> 1491 self._remove_variables(rm_var)
1492 self._pending_modifications.rm_var = []
1493 callback()
File ~/anaconda3/lib/python3.9/site-packages/optlang/glpk_interface.py:753, in Model._remove_variables(self, variables)
751 num = intArray(len(variables) + 1)
752 for i, variable in enumerate(variables):
--> 753 num[i + 1] = variable._index
754 glp_del_cols(self.problem, len(variables), num)
756 for variable in variables:
File ~/anaconda3/lib/python3.9/site-packages/swiglpk/swiglpk.py:1069, in intArray.setitem(self, index, value)
1068 def setitem(self, index, value):
-> 1069 return swiglpk.intArray___setitem_(self, index, value)
TypeError: in method 'intArray___setitem__', argument 3 of type 'int' `
I only altered the solver and I'm unsure why this error would occur? I'm unsure of how I can solve this I've experimented a bit but got stuck.
Of note I had some trouble with another environment Troppo package where the GIMMEproperties did not have all the current arguments (i.e. solver), could this be similar installation problem despite having worked well up until this point?
Thanks in advance!
Edit:
I tried to install troppo in Google Colab and see if it's a problem from my Anaconda installation. What happened is that the in the Solver CPLEX still didn't exist, GLPK still made the same TypeError but I had the option of using SCIPY or OSQP (one more than in my installed environments).
OSQP did in fact finish the model! (SciPy was taking too long so I had to kill it). So it may be a problem with the GLPK solver itself for some reason?
Edir 2:
Tried the iMAT and a TypeError also happens there (this one ">=" not supported between instances of 'list' and 'float') again, I changed nothing of the script except location of files.
The text was updated successfully, but these errors were encountered: