Cannot import name 'ResultCollection' from 'qiime2.sdk'

I was originally running qiime2-2023.2 but had to install qiime2-2023.5 to go along with the 2023.5 version of q2-fmt-alpha.

I tried to generate a raincloud plot and it gave me an error

qiime stats plot-rainclouds \
  --i-data timepoint-dists.qza \
  --i-stats stats_baseline0.qza \
  --o-visualization raincloud-baseline0.qzv

Based on previous posts on the forum about other plug-ins, it seems like q2-fmt is having trouble interfacing with the qiime2. Is this because q2-fmt is still trying to interface with the original qiime2 i.e. 2023.2 and not 2023.5? I have already tried reinstalling 2023.5. Should I try uninstalling 2023.2 and then try to re-run the command? Would uninstalling 2023.2 affect anything as so far I have been running 2023.2

Traceback (most recent call last):
File "/home/ubuntu/miniconda3/envs/q2-fmt-alpha/bin/qiime", line 11, in
File "/home/ubuntu/miniconda3/envs/q2-fmt-alpha/lib/python3.8/site-packages/click/", line 1157, in call
return self.main(*args, **kwargs)
File "/home/ubuntu/miniconda3/envs/q2-fmt-alpha/lib/python3.8/site-packages/click/", line 1078, in main
rv = self.invoke(ctx)
File "/home/ubuntu/miniconda3/envs/q2-fmt-alpha/lib/python3.8/site-packages/click/", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/ubuntu/miniconda3/envs/q2-fmt-alpha/lib/python3.8/site-packages/click/", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/ubuntu/miniconda3/envs/q2-fmt-alpha/lib/python3.8/site-packages/click/", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/ubuntu/miniconda3/envs/q2-fmt-alpha/lib/python3.8/site-packages/click/", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/ubuntu/miniconda3/envs/q2-fmt-alpha/lib/python3.8/site-packages/q2cli/", line 336, in call
from qiime2.sdk import ResultCollection
ImportError: cannot import name 'ResultCollection' from 'qiime2.sdk' (/home/ubuntu/miniconda3/envs/q2-fmt-alpha/lib/python3.8/site-packages/qiime2/sdk/

Thanks for your help :slight_smile:

Hello @macrobiome,

First you say that you are using 2023.5 but then later you say that you are using 2023.2. ResultCollections, what you're getting an error about, were added in 2023.5--so you need to have 2023.5 installed and activated to use them.

Hi Colin, sorry for the confusion. I originally had 2023.2 installed, but subsequently also installed 2023.5 and q2-fmt (v2023.5). Therefore I have 3 environments currently installed

Here are my current conda environments

conda environments:

base * /home/ubuntu/miniconda3
q2-fmt-alpha /home/ubuntu/miniconda3/envs/q2-fmt-alpha
qiime2-2023.2 /home/ubuntu/miniconda3/envs/qiime2-2023.2
qiime2-2023.5 /home/ubuntu/miniconda3/envs/qiime2-2023.5

Hello @macrobiome,

When you have 2023.5 activated you shouldn't see the above error. When you have 2023.2 activated you should.

Thanks! I deactivated 2023.2 environment using conda deactivate and then activated both qiime2-2023.5 and q2-fmt-alpha. I am still getting the same error. Would it help if I run both qiime2-2023.5 and q2-fmt-alpha in a separate instance where there is no 2023.2 present?

Hello @macrobiome,

What do you mean when you say you activated q2-fmt-alpha? Is that an environment that you have?

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