emperor icon indicating copy to clipboard operation
emperor copied to clipboard

AttributeError: 'Emperor' object has no attribute 'render_base_dependencies'

Open fedarko opened this issue 3 years ago • 2 comments

While I was running Empress to generate an Empire plot (just using the normal moving pictures data), I kept getting this error:

Traceback (most recent call last):
  File "/home/marcus/Software/miniconda2/envs/qiime2-2021.2/lib/python3.6/site-packages/q2cli/commands.py", line 329, in __call__
    results = action(**arguments)
  File "</home/marcus/.local/lib/python3.6/site-packages/decorator.py:decorator-gen-547>", line 2, in community_plot
  File "/home/marcus/Software/miniconda2/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
    output_types, provenance)
  File "/home/marcus/Software/miniconda2/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/sdk/action.py", line 452, in _callable_executor_
    ret_val = self._callable(output_dir=temp_dir, **view_args)
  File "/home/marcus/Dropbox/Work/KnightLab/Empress/fedarko/empress/empress/_plot.py", line 53, in community_plot
    save_viz(viz, output_dir)
  File "/home/marcus/Dropbox/Work/KnightLab/Empress/fedarko/empress/empress/_plot_utils.py", line 52, in save_viz
    htmlfile.write(str(viz))
  File "/home/marcus/Dropbox/Work/KnightLab/Empress/fedarko/empress/empress/core.py", line 269, in __str__
    return self.make_empress()
  File "/home/marcus/Dropbox/Work/KnightLab/Empress/fedarko/empress/empress/core.py", line 294, in make_empress
    data = self.to_dict()
  File "/home/marcus/Dropbox/Work/KnightLab/Empress/fedarko/empress/empress/core.py", line 391, in to_dict
    data_to_render.update(self._scavenge_emperor())
  File "/home/marcus/Dropbox/Work/KnightLab/Empress/fedarko/empress/empress/core.py", line 424, in _scavenge_emperor
    emperor_base_dependencies = self._emperor.render_base_dependencies()
AttributeError: 'Emperor' object has no attribute 'render_base_dependencies'

This was within a QIIME 2 2021.2 conda environment, with emperor 1.0.2 installed. I was pretty confused, since v1.0.2 should have render_base_dependencies installed. (For reference, this error was also documented on the Q2 forums a few months back here.) However, I was running this within a conda environment I'd been using for quite some time; I'm pretty sure this Q2 environment worked fine with Empress/Emperor for a while. Maybe something I installed messed things up...?

Installing emperor 1.0.3 fixed the problem, strangely (now I can generate Empire plots without a problem). Even more strangely, installing emperor 1.0.2 again (replacing v1.0.3 with v1.0.2) still fixed the problem?

I'm not sure of the cause of this error, but I wanted to document it. There might be some sort of weird inconsistency issue that pops up in QIIME 2 environments when certain things go wrong; it seems like reinstalling Emperor >= 1.0.2 consistently fixes the problem. If other folks start running into this error, we could investigate further.

fedarko avatar Jun 22 '21 22:06 fedarko

This sounds like a python package installation issue. If you are able to reproduce the issue, are you able to import the Emperor object and confirm that it is missing the necessary attributes? In that case would you be able to run:

import emperor
print(emperor.__file__, emperor.__version__)

ElDeveloper avatar Jul 14 '21 19:07 ElDeveloper

Eesh - I tried with few old Q2 environments (plus a freshly installed Q2 2021.2 environment) and haven't been able to reproduce the problem yet (installing Empress automatically installed the right Emperor version, and I've been able to generate Empire plots without a problem)... now I'm wishing I hadn't fixed this for myself!

If I run into this problem again I'll make sure to run the debug code you listed above and report back.

fedarko avatar Jul 17 '21 05:07 fedarko