-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Troppo_tutorial_GIMME seem to have problems #42
Comments
Hello! What version of Python are you currently using in your environment? I’ve encountered similar issues when working with more recent versions of Python. The root of the problem is that Troppo is optimized for Python 3.7, however, it may not function as expected with later versions. To resolve this, we recommend creating an environment specifically for Python 3.7, as Troppo has not yet been updated to fully support newer versions. |
Hello! Thank you for answering. I was trying with several versions (3.8 to 3.10) where I did manage to install troppo. Today I installed python 3.7 in a new environment (using UV package manager and Anaconda later out of curiosity) as suggested however it is not allowing for installation of a dependency related with the cobamp. Specifically I got this message:
I did try the earliest version of python 3.7.7 available in uv after this but it gave the same error unfortunately. Seems like the error now is from cobamp. Unless there's a wheel for an earlier version of 3.7.7 or we can use another version of cobamp maybe? I know troppo has been used this summer on a workshop so maybe there were new versions from the dependencies (in this case within cobamp) that came out recently? Thanks! |
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: