q2-micom grow Pluggin error 'NoneType' object has no attribute 'problem'

Hi everyone,

I just started with q2-micom and I am trying the community tutorial (with provided dataset and model). Unfortunately, when running

“qiime micom grow --i-models models.qza --i-medium western_diet_gut.qza --p-tradeoff 0.3 --o-results growth.qza --verbose”

I get the error
"Plugin error from micom:
‘NoneType’ object has no attribute ‘problem’ ".

Any idea how to fix it?
Thank you

Welcome to the forum, @silviac!

I am just cc:ing @cdiener and @seangibbons to get this on their radar! In the meantime, please post the full error message here if there is more information.

Thank you so much.
Here is the full error:

^M 0%| | 0/16 [00:00<?, ?sample(s)/s]Using license file /Users/silviac/gurobi.lic
Academic license - for non-commercial use only - expires 2021-01-30
Read LP format model from file /var/folders/sc/zmkl46796djgg04cb7k9b8jm0000gn/T/tmp88c65jvi.lp
Reading time = 0.05 seconds
: 4423 rows, 14261 columns, 55117 nonzeros
^M 0%| | 0/16 [00:01<?, ?sample(s)/s]
multiprocessing.pool.RemoteTraceback:
“”"
Traceback (most recent call last):
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/multiprocessing/pool.py”, line 119, in worker
result = (True, func(*args, **kwds))
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/micom/workflows/grow.py”, line 18, in _growth
com = load_pickle§
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/micom/util.py”, line 74, in load_pickle
mod = pickle.load(infile)
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/optlang/gurobi_interface.py”, line 604, in setstate
self.configuration = Configuration.clone(repr_dict[‘config’], problem=self) # TODO: make configuration work
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/optlang/interface.py”, line 1002, in clone
parameters[“tolerances”] = config.tolerances.to_dict()
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/optlang/util.py”, line 290, in to_dict
return {key: getattr(self, key) for key in self._functions.keys()}
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/optlang/util.py”, line 290, in
return {key: getattr(self, key) for key in self._functions.keys()}
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/optlang/util.py”, line 280, in getattr
return self._functions[item]0
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/optlang/gurobi_interface.py”, line 483, in _get_feasibility
return getattr(self.problem.problem.params, “FeasibilityTol”)
AttributeError: ‘NoneType’ object has no attribute ‘problem’
“”"

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2cli/commands.py”, line 329, in call
results = action(**arguments)
File “”, line 2, in grow
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 245, in bound_callable
output_types, provenance)
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 390, in callable_executor
output_views = self._callable(**view_args)
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2_micom/_growth.py”, line 25, in grow
manifest, model_folder, medium, tradeoff, threads)
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/micom/workflows/grow.py”, line 124, in grow
results = workflow(_growth, args, threads)
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/micom/workflows/core.py”, line 41, in workflow
results = list(it)
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/tqdm/std.py”, line 1193, in iter
for obj in iterable:
File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/multiprocessing/pool.py”, line 735, in next
raise value
AttributeError: ‘NoneType’ object has no attribute ‘problem’

/var/folders/sc/zmkl46796djgg04cb7k9b8jm0000gn/T/qiime2-q2cli-err-y39t_rvv.log (END)

Hi,

Looks like your Gurobi install did not work. Can you try updating gurobi and optlang with conda update -c gurobi -c conda-forge gurobi optlang and rerun qiime micom build to see if that works?

In the long run we recommend to use CPLEX if you have access (looks like you would qualify since you already have an academic license for Gurobi). That will be 10-100x faster in general.

1 Like

Hi,

Unfortunately the update of gurobi and optlang didn’t help. I could re-build the models but not to go further with ‘qiime micom grow’. The same error was generated. Therefore, I decided to uninstall Gurobi (which I did with ‘conda remove gurobi’) and have CPLEX installed. Since, I’m qualified only for academic licence, I got CPLEX_Studio_Community1210. I followed the recommended installation by doing:

% pip install /Applications/CPLEX_Studio_Community1210/cplex/python/3.6/x86-64_osx

and I got the confirmation that installation was successful.

*qiime2-2020.8) [email protected]_64-apple-darwin13 q2Micom % pip install /Applications/CPLEX_Studio_Community1210/cplex/python/3.6/x86-64_osx *
Processing /Applications/CPLEX_Studio_Community1210/cplex/python/3.6/x86-64_osx
Building wheels for collected packages: cplex

  • Building wheel for cplex (setup.py) … done*
  • Created wheel for cplex: filename=cplex-12.10.0.0-py3-none-any.whl size=11516906 sha256=e60a7066c2e32ad4b2ddb1b25eca253921c13226dd5d19dec6a8d725d4f84f77*
  • Stored in directory: /Users/silviac/Library/Caches/pip/wheels/db/cf/3a/770c1c95bcfbb5a9a78e4fe7842e482d19ecc09798fe2c1f71*
    Successfully built cplex
    Installing collected packages: cplex
  • Attempting uninstall: cplex*
  • Found existing installation: cplex 12.10.0.0*
  • Uninstalling cplex-12.10.0.0:*
  •  Successfully uninstalled cplex-12.10.0.0*
    

Successfully installed cplex-12.10.0.0

And, further I managed to build the models

*qiime2-2020.8) [email protected]_64-apple-darwin13 q2Micom % qiime micom build --i-abundance crc_table.qza --i-taxonomy crc_taxa.qza --i-models agora103_genus.zip --p-cutoff 0.05 --o-community-models test3_models.qza

/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/skbio/util/_testing.py:15: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.
import pandas.util.testing as pdt
Saved CommunityModels[Pickle] to: test3_models.qza

However, going further with ‘grow’ is still not possible. Now I get another error, which looks like this:

Traceback (most recent call last):

  • File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2cli/commands.py”, line 329, in call*
  • results = action(*arguments)
  • File “”, line 2, in grow*
  • File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 245, in bound_callable*
  • output_types, provenance)*
  • File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 390, in callable_executor*
  • output_views = self._callable(*view_args)
  • File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/q2_micom/_growth.py”, line 25, in grow*
  • manifest, model_folder, medium, tradeoff, threads)*
  • File “/Users/silviac/opt/anaconda3/envs/qiime2-2020.8/lib/python3.6/site-packages/micom/workflows/grow.py”, line 127, in grow*
  • "All numerical optimizations failed. This indicates a problem "*
    cobra.exceptions.OptimizationError: All numerical optimizations failed. This indicates a problem with the solver or numerical instabilities. Check that you have CPLEX or Gurobi installed. You may also increase the abundance cutoff to create simpler models.

Thank you so much for helping me.

Hmm weird about Gurobi. I will test that from my site. The Cplex versions are a bit confusing. The community edition is a free version that only allows up to 1000 variables which is why it fails here. If you signed up for the IBM academic initiative you can download a full version for free: https://community.ibm.com/community/user/datascience/blogs/xavier-nodet1/2020/07/09/cplex-free-for-students. This one should work.

Hi,

I have some updates regarding my problem with q2-micom. Meanwhile, I had reinstalled Gurobi (with a fully new academic licence) and I could run without error ‘micom’ tutorial outside qiime2 (just as indicated at https://micom-dev.github.io/micom/high_level.html). But, I am not sure if the input ‘data’ of this tutorial is the same as the q2-micom. Again, when I tried in qiime the error persisted (I can build the models, but I cannot simulate grow, and therefore I cannot move further). I was thinking that I could use ‘micom’ outside qiime, but I don’t know how to import the qiime files in the program. Would this be a solution? Could you please help me with some general instructions ? I looked already in the materials available (isb_course_2020-master) but I could not figure out this point. Thank you so much again for helping me

Definitely interesting, since the q2-micom plugin just calls the micom high level API. I’ll try to reproduce that and hopefully find a fix. Yes, you can absolutely import the qiime data and run the high level workflow. The course notebook actually does that: https://colab.research.google.com/github/Gibbons-Lab/isb_course_2020/blob/master/micom.ipynb . See the section “Importing data from Qiime 2”.

Best
Christian

So I set up a fresh Qiime 2 environment and followed the instructions on https://micom-dev.github.io/q2-micom/ to run the tutorial with Gurobi and everything worked, albeit pretty slow. This was on Linux though so there might be an issue specific to Gurobi on MacOS, which I can’t really test right now since I don’t have access to Mac right now. Sorry about that! The only thing I could recommend is doing a fresh install in a new Qiime 2 2020.11 environment and making sure that the GRB_LICENSE_KEY variable is set…

Best

1 Like