# Plugin error from diversity: Cannot infer number of levels from empty list

**URL:** <https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213>\
**Category:** User Support\
**Tags:** diversity, alpha-rarefaction, pending-development\
**Created:** [May 18, 2018, 5:22pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213 "2018-05-18T17:22:46Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jelly\_fan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/j/e36b37/32.png) [@jelly\_fan](https://forum.qiime2.org/u/jelly_fan)\
**Post date:** [May 18, 2018, 5:22pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/1 "2018-05-18T17:22:46Z")

</div>

New user here. I've filtered and clustered my data in DADA2 standalone (my sequencing run had multiple amplicons I needed to handle separately) and imported it into QIIME2 as a BIOM 2.1 file for taxonomic assignment and visualisations. Almost everything is working as expected, However when I enter:

> qiime diversity alpha-rarefaction   
> --i-table table.qza   
> --i-phylogeny rooted-tree.qza   
> --p-max-depth 4000   
> --m-metadata-file test\_metadata.tsv   
> --o-visualization alpha-rarefaction.qzv

I get the following error message message:

> Plugin error from diversity: Cannot infer number of levels from empty list

Can someone help me identify (and fix) the problem?

Thanks so much!

---

<div class="post-metadata">

**Author:** ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)\
**Post date:** [May 19, 2018, 12:41am UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/2 "2018-05-19T00:41:10Z")

</div>

HI @jelly_fan,  
Could you please share the complete error traceback? (you can re-run the command with `--verbose` added to the end of the command to see the full error)

Please also run `qiime feature-table summarize` on your feature table and share the results (you can send directly to me if these are sensitive data). I suspect either you may be using a higher `max-depth` than there are sequences in any single sample or else there is something wrong with the phylogeny.

Let's start there and see where it takes us!

---

<div class="post-metadata">

**Author:** ![jelly\_fan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/j/e36b37/32.png) [@jelly\_fan](https://forum.qiime2.org/u/jelly_fan)\
**Post date:** [May 19, 2018, 12:02pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/3 "2018-05-19T12:02:19Z")

</div>

Thank you for you for the quick response! I really appreciate it.

When I entered the verbose command I didn't get any additional information. However, when I re-ran the command without the verbose command the server logged some debug information to file. Hopefully this is what you need / helps:

> Traceback (most recent call last):  
> File "/gpfs/software/python/anaconda/4.2/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2cli/commands.py", line 246, in **call**  
> results = action(\*\*arguments)  
> File "", line 2, in alpha\_rarefaction  
> File "/gpfs/software/python/anaconda/4.2/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/sdk/action.py", line 228, in bound\_callable  
> output\_types, provenance)  
> File "/gpfs/software/python/anaconda/4.2/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/sdk/action.py", line 424, in _callable\_executor_  
> ret\_val = self.\_callable(output\_dir=temp\_dir, \*\*view\_args)  
> File "/gpfs/software/python/anaconda/4.2/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2\_diversity/\_alpha/\_visualizer.py", line 328, in alpha\_rarefaction  
> [(c, '') for c in metadata\_df.columns])  
> File "/gpfs/software/python/anaconda/4.2/anaconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/pandas/core/indexes/multi.py", line 1189, in from\_tuples  
> raise TypeError(msg)  
> TypeError: Cannot infer number of levels from empty list

I don't think my data is sensitive. (The community data came from wild fish - so no data privacy issues!). Here is the table summary:

[table\_summary.qzv](https://cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/flex002/uploads/qiime21/original/2X/5/56ebc99991797ea061f379046318ca849e59ed16.qzv) (360.8 KB)

---

<div class="post-metadata">

**Author:** ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)\
**Post date:** [May 21, 2018, 4:39pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/4 "2018-05-21T16:39:59Z")

</div>



---

<div class="post-metadata">

**Author:** ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)\
**Post date:** [May 23, 2018, 12:51pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/5 "2018-05-23T12:51:31Z")

</div>



---

<div class="post-metadata">

**Author:** ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)\
**Post date:** [May 23, 2018, 12:51pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/6 "2018-05-23T12:51:34Z")

</div>



---

<div class="post-metadata">

**Author:** ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)\
**Post date:** [May 24, 2018, 2:07am UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/7 "2018-05-24T02:07:34Z")

</div>

> [@jelly\_fan](#):
>
> what you need / helps

❤

This error message is pretty helpful, and this is a new error for me --- it looks like there is an issue somehow related to your metadata. Can you please send `test_metadata.tsv` along when you get a chance? Thanks! :qiime2:

---

<div class="post-metadata">

**Author:** ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)\
**Post date:** [May 24, 2018, 2:07am UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/8 "2018-05-24T02:07:38Z")

</div>



---

<div class="post-metadata">

**Author:** ![jelly\_fan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/j/e36b37/32.png) [@jelly\_fan](https://forum.qiime2.org/u/jelly_fan)\
**Post date:** [May 24, 2018, 12:35pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/9 "2018-05-24T12:35:22Z")

</div>

Thank you for looking into this further for me.

Glad the output was useful.

Here is the .tsv file. It's the bare minimum, just sample IDs - I wanted to keep everything as simple as possible while running a pilot pipeline.

[test\_metadata.tsv](https://cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/flex002/uploads/qiime21/original/2X/9/96df645b380a3b9a73e406b7d253dcfd86311ae3.tsv) (2.2 KB)

---

<div class="post-metadata">

**Author:** ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)\
**Post date:** [May 24, 2018, 12:36pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/10 "2018-05-24T12:36:50Z")

</div>



---

<div class="post-metadata">

**Author:** ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)\
**Post date:** [May 27, 2018, 11:44pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/11 "2018-05-27T23:44:36Z")

</div>

Ah ha! Thanks for the metadata, @jelly_fan! I see the issue --- your metadata has no defined metadata columns, effectively it is just a list of IDs, or, empty metadata.

To get you moving forward right now, you can just run this command sans metadata and get the exact same results:

```bash
qiime diversity alpha-rarefaction \
  --i-table table.qza \
  --i-phylogeny rooted-tree.qza \
  --p-max-depth 4000 \
  --o-visualization alpha-rarefaction.qzv

```

I have [opened an issue on the relevant bug tracker](https://github.com/qiime2/q2-diversity/issues/199) to make sure that this viz gracefully handles empty metadata in the future.

As well, I would suggest taking a read through the [Metadata Tutorial!](https://docs.qiime2.org/2018.4/tutorials/metadata/)

Good luck! 🦖 :qiime2:

---

<div class="post-metadata">

**Author:** ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)\
**Post date:** [May 27, 2018, 11:44pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/12 "2018-05-27T23:44:39Z")

</div>



---

<div class="post-metadata">

**Author:** ![jelly\_fan](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/j/e36b37/32.png) [@jelly\_fan](https://forum.qiime2.org/u/jelly_fan)\
**Post date:** [May 29, 2018, 12:23pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/13 "2018-05-29T12:23:07Z")

</div>

Hi,

Just wanted to confirm my rarefaction curves came out nicely with your code, and also when I added in some relevant metadata - the original command started working too.

Thank you for all your help (and developing such a good program).

---

<div class="post-metadata">

**Author:** ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)\
**Post date:** [June 29, 2018, 6:35pm UTC](https://forum.qiime2.org/t/plugin-error-from-diversity-cannot-infer-number-of-levels-from-empty-list/4213/14 "2018-06-29T18:35:00Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
