[Moving Picture Tutorial] Issues when running the "core-metrics-phylogeny" pipeline in "diversity" plugin

Hi all,
I am working on the Moving Picture tutorial and encountered a problem when trying to run the "core-metrics-phylogeny" pipeline for alpha and beta diversity analysis. My code is exactly the same to that in the tutorial:

qiime diversity core-metrics-phylogenetic \
--i-phylogeny rooted-tree.qza \
--i-table table-dada2.qza \
--p-sampling-depth 1103 \
--m-metadata-file sample-metadata.tsv \
--output-dir core-metrics-results \
--verbose

And the error is:

skbio.diversity.alpha.sobs(counts=counts))
Attribute Error: module 'skbio.diversity.alpha' has no attribute 'sobs'

I tried to look into the documentation of skbio, yet there seems to be not attribute named 'sobs'. I also tried to install the scikit.bio package and update my qiime2, yet the problem is still not fixed. Is there any new update in the pipeline that I might have missed? I have screened through the forum yet there is no one having this problem. Thank you very much!!!

1 Like

Hello @hoangle, welcome to the forums!

This term was changed, and it looks like something was not fully updated...

sobs will replace observed_otus, which uses the historical term "OTU". Also added metric observed_features to be compatible with the QIIME 2 terminology.

Can you run qiime info and post the results so we can see what software versions you have installed?

Hi @colinbrislawn, thanks for your prompt response! I tried running qiime info and here is what I get

System versions
Python version: 3.9.19
QIIME 2 release: 2024.5
QIIME 2 version: 2024.5.0
q2cli version: 2024.5.0

Installed plugins
alignment: 2024.5.0
composition: 2024.5.0
cutadapt: 2024.5.0
dada2: 2024.5.0
deblur: 2024.5.0
demux: 2024.5.0
diversity: 2024.5.0
diversity-lib: 2024.5.0
emperor: 2024.5.0
empress: 1.2.0
feature-classifier: 2024.5.0
feature-table: 2024.5.0
fragment-insertion: 2024.5.0
longitudinal: 2024.5.0
metadata: 2024.5.0
phylogeny: 2024.5.0
quality-control: 2024.5.0
quality-filter: 2024.5.0
rescript: 2024.5.0
sample-classifier: 2024.5.0
taxa: 2024.5.0
types: 2024.5.0
vsearch: 2024.5.0

Application config directory
/Users/phamnguyenhoangle/miniconda3/envs/qiime2-amplicon-2024.5/var/q2cli

Getting help
To get help with QIIME 2, visit https://qiime2.org

As what I interpret from your hyperlink, the problem here might be that my version is not up-to-date. Yet earlier today I deleted qiime2 and re-installed, and the problem is still there. Is there any thing that I might have overlooked? Thank you!

1 Like

Hi @hoangle, I just got the same error and when I loaded qiime2/2024.2 instead of qiime2/2024.5 I was able to run core-metrics-phylogenetic successfully. I think the skbio update happened in the last two weeks or so that may have something to do with it. I hope this works for you too!

2 Likes

Hi @hoangle,

Jumping in for @colinbrislawn here - we both tested using q2-diversity 2024.5.0 and didn't run into this issue. It seems as though you may be working with a different version of scikit-bio (which, as you already deduced, is where this issue is coming frrom).

Would you mind sharing your output after running the following command?

conda list scikit-bio

I'd like to see if you're somehow working with an older version (sobs wasn't added into their API until version 0.6.0). Thanks!

3 Likes

Hi @lizgehret
Sorry for delayed response. I see the problem now that I check the current version of scikit-bio. I ran conda list scikit-bio and the returning result is as below:

# packages in environment at /Users/phamnguyenhoangle/miniconda3/envs/qiime2-amplicon-2024.5:
#
# Name                    Version                   Build  Channel
scikit-bio                0.5.9                    pypi_0    pypi

I tried to update scikit-bio to version 0.6.0 like you mentioned using the following codes:

conda update scikit-bio

and

conda install -c conda-forge scikit-bio

Yet when I checked the version again, it's still 0.5.9. Can you assist me on how to update properly? Thanks a lot!!!

Strange!

Try
mamba install scikit-bio=0.6.0
and post everything that it says!

1 Like

Hi!
My computer doesn't have mamba, so I tried:

conda install scikit-bio=0.6.0

The result is the same (i.e., my scikit-bio version is still 0.5.9). So I tried to install mamba as a replacement for conda using the code below:

conda config --add channels conda-forge
conda update -n base --all
conda install -n base mamba

Then I ran the code as you suggested:

mamba install scikit-bio=0.6.0

When I checked again, to my surprise, the scikit-bio version is still 0.5.9 (I checked with both mamba list scikit-bio and conda list scikit-bio. The detailed result is:

# packages in environment at /Users/phamnguyenhoangle/miniconda3/envs/qiime2-amplicon-2024.5:
#
# Name                    Version                   Build  Channel
scikit-bio                0.5.9                    pypi_0    pypi

Is there anything I can do to work this around? For eg as @kyra.e suggested above, should I use qiime2/2024.2 version (instead of the current qiime2/2024.5)?

1 Like

Thank you for trying that!

I'm not so sure... Let's see what the Qiime2 devs recommend!

Maybe it's an issue with having the pypi channel? I don't have the pypi channel in my channel list.

Hi,
I tried to work around the problem by uninstalling scikit-bio using this code:

pip uninstall scikit-bio

Then reinstall:

conda install scikit-bio=0.6.0

And it worked. The current version of my scikit-bio is 0.6.0:

# Name                    Version                   Build  Channel
scikit-bio                0.6.0            py39h5b4affa_4    conda-forge

However, when I tried to run the code for the Moving Picture tutorial (i.e., the code in the first post in this thread), the problem is that qiime2-amplicon-2024.5 requires scikit-bio version <0.6.0 and >=0.5.0 (see the error below):

pkg_resources.ContextualVersionConflict: (scikit-bio 0.6.0 (/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages), Requirement.parse('scikit-bio<0.6.0,>=0.5.0'), {'iow'})

Do you think this problem has anything to do with my version of qiime2?

1 Like

Can you also run
conda config --show channels

Here's my setup, which is WSL

channels:
  - conda-forge
  - bioconda
  - defaults
  - r

I run all of these in my Terminal on Mac. My channel is slightly different:

channels:
  - conda-forge
  - defaults

Does this has anything to do with my problem? I tried install bioconda and r, yet nothing changed.

The plot thickens!

If you don't have a pypi in your conda channels, how did this old version of scikit-bio from pypi get onto your Mac?

:thinking: :apple: :snake:

Oops, my bad.
I ran the code in Terminal of Visual Code Studio, not the Terminal on Mac :sweat_smile:

The VS Code terminal should be the same as the native Terminal... (That's how my setup works)

Now may be a good time to rerun everything, taking notes along the way so we can look for clues.

Remember that the Terminal is ruthless about small details.

Once you are done, share all your notes here.

For me, it happened when Greengenes2 plugin was installed.
...
Installing collected packages: nose, scipy, regex, msgpack, cython, nltk, scikit-bio, redbiom, q2-greengenes2
Attempting uninstall: scipy
Found existing installation: scipy 1.13.0
Uninstalling scipy-1.13.0:
Successfully uninstalled scipy-1.13.0
Attempting uninstall: scikit-bio
Found existing installation: scikit-bio 0.6.0
Uninstalling scikit-bio-0.6.0:
Successfully uninstalled scikit-bio-0.6.0
Successfully installed cython-3.0.10 msgpack-1.0.8 nltk-3.8.1 nose-1.3.7 q2-greengenes2-2024.1 redbiom-0.3.9 regex-2024.5.15 scikit-bio-0.5.9 scipy-1.10.1

Seems like installing Greengenes2 will downgrade scikit-bio and others in QIIME2-2024.5!

3 Likes

Hi, sorry for the delayed reply. I tried running the codes above all over again and here's what I get for each:

  1. conda list scikit-bio returns
# packages in environment at /Users/miniconda3/envs/qiime2-amplicon-2024.5:
#
# Name                    Version                   Build  Channel
scikit-bio                0.6.0            py39h5b4affa_4    conda-forge
  1. conda config --show channels returns
channels:
  - r
  - bioconda
  - conda-forge
  - defaults

After checking these, I tried running the Moving Picture Tutorial from scratch, and here is where scikit-bio 0.6.0 turns problematic:

qiime tools import \
  --type EMPSingleEndSequences \
  --input-path emp-single-end-sequences \
  --output-path emp-single-end-sequences.qza

returns


Traceback (most recent call last):
  File "/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/builtin/tools.py", line 852, in _import
    artifact = qiime2.sdk.Artifact.import_data(
  File "/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/result.py", line 304, in import_data
    pm = qiime2.sdk.PluginManager()
  File "/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/plugin_manager.py", line 67, in __new__
    self._init(add_plugins=add_plugins)
  File "/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/plugin_manager.py", line 105, in _init
    plugin = entry_point.load()
  File "/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2473, in load
    self.require(*args, **kwargs)
  File "/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2497, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/pkg_resources/__init__.py", line 787, in resolve
    dist = self._resolve_dist(
  File "/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/pkg_resources/__init__.py", line 833, in _resolve_dist
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (scikit-bio 0.6.0 (/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages), Requirement.parse('scikit-bio<0.6.0,>=0.5.0'), {'iow'})

An unexpected error has occurred:

  (scikit-bio 0.6.0 (/Users/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages), Requirement.parse('scikit-bio<0.6.0,>=0.5.0'), {'iow'})

See above for debug info.

Is it possible if certain parts of the tutorial require scikit-bio 0.6.0, while the others call for the 0.5.9 version? Thanks a lot!!

1 Like

Hey @hoangle,

Thanks for providing those details!

Nope, as of QIIME 2 2024.5, all plugins and commands utilize scikit-bio 0.6.0.

This raises some alarm bells for me - your channel list shouldn't include r within your QIIME 2 environment. This could certainly be part of the problem.

I think it's worth trying to start from a clean slate (i.e. fresh conda environment) to see if this is just an issue with your current environment. Let's try the following steps:

  1. Make sure you've deactivated this conda environment by running conda deactivate. You should see (base) as the prefix on your command line. If you still see a conda environment name, re-run the deactivate command until you're back to your base environment.
  2. Disable your conda channel priority by running conda config --set channel_priority disabled. Our QIIME 2 environments specify the channels where each package should be searched for in the environment file, so you shouldn't have to make any special changes on your end for this.
  3. Run conda clean --all to remove any stray package caches/etc.
  4. Re-install QIIME 2 2024.5 Amplicon environment following these install steps.

Once you've done all of this, go ahead and activate this new environment and run the following commands to check package versions:

qiime info
conda list scikit-bio

Please share the results in your reply. Thanks! :lizard:

4 Likes