No module named metaphlan.utils.cmseq


my env

conda create -n biobakery python=3.6 biobakery_workflows networkx=1.11 pweave=0.25 leveldb=0.193 hclust2 megahit prokka seqtk trimmomatic biopython=1.77

packages in environment at /home/xmk/anaconda3/envs/biobakery:

anadama2 0.7.5 pyha9737eb_0 biobakery
biobakery_workflows 3.0.0a4 pyh41f93f0_0 biobakery
humann 3.0.0.alpha.3 pyh9056e2e_0 biobakery

my command

biobakery_workflows wmgx -i test_reads -o biobakery_results --threads 12 --run-assembly --input-extension fastq.gz --pair-identifier “_R1.” --qc-options “–trimmomatic /home/xmk/anaconda3/envs/biobakery/share/trimmomatic-0.39-1”

report error

from .cmseq import cmseq\nModuleNotFoundError: No module named ‘metaphlan.utils.cmseq’\n’

Hi @wangzhichao1990 could you please tell me the version of metaphlan you have installed?


I have the same error as above.

My version of metaphlan is MetaPhlAn version 3.0.5 (10 Nov 2020)

Thank you in advance!

Hi @annarerra
Are you executing the biobakery_workflows command too? In this case, I suggest you to move the question to this forum: where they can help you better with the biobakery_workflows installation problems


Hello Aitor,

Thank you for your reply.
I am not executing the biobakery_workflows command, I was running Strainphlan and it happened to have the above error during the 2nd step samples to markers…

But after some modifications I have a new error, still related to the module cmseq:

Sun Nov 29 17:12:14 2020: Start samples to markers execution
Sun Nov 29 17:12:14 2020: Decompressing samples…
Sun Nov 29 17:12:53 2020: Done.
Sun Nov 29 17:12:53 2020: Converting samples to BAM format…
Sun Nov 29 17:13:22 2020: Done.
Sun Nov 29 17:13:22 2020: Sorting BAM samples…
Sun Nov 29 17:13:41 2020: Done.
Sun Nov 29 17:13:41 2020: Getting consensus markers from samples…
Sun Nov 29 17:13:41 2020: Processing sample: /site/ly/work/projects/Share/ESPRIOAC_FUI/strainer_tutorial/consensus_markers/tmp/patient3_plvt_19004654501_syno_S38.bamTraceback (most recent call last):
File “/site/ly/home/lboucinha/Tools/conda_meta_strai_phlan/MetaPhlAn-master/metaphlan/utils/”, line 272, in
File “/site/ly/home/lboucinha/Tools/conda_meta_strai_phlan/MetaPhlAn-master/metaphlan/utils/”, line 265, in main
args.breadth_threshold, args.nprocs)
File “/site/ly/home/lboucinha/Tools/conda_meta_strai_phlan/MetaPhlAn-master/metaphlan/utils/”, line 243, in samples_to_markers
execute_cmseq(input, output_dir, breath_threshold, nprocs)
File “/site/ly/home/lboucinha/Tools/conda_meta_strai_phlan/MetaPhlAn-master/metaphlan/utils/”, line 211, in execute_cmseq
results = collection.parallel_reference_free_consensus(ncores=nprocs, consensus_rule=cmseq.BamContig.majority_rule_polymorphicLoci)
AttributeError: module ‘cmseq.cmseq’ has no attribute 'BamContig’

I would appreciate it if you had any feedback about this…

Thank you in advance!


Hi @annarerra
Could you tell me which modifications did you do for skipping the first error?

Hello Aitor,

In the beginning, I used the script that it was in the bin folder of the installation.
But after, I used the script that it was in metaphlan/utils/ and now I am getting the error that I mentioned…

I hope it is clear… :stuck_out_tongue:

Thank you again for you time.

Hi @annarerra
One last question, did you installed MetaPhlAn using Conda?


Yes creating a new conda environment…

Ok, if you installed it using conda you should call directly without specifying any route (but it actually calls the script in the bin folder of the installation). As this script is not finding the cmseq installation I would try to reinstall it using conda install -c bioconda cmseq

Ok, i see what you mean…

However, in the folder metaphlan/utils/ there is a folder called cmseq and as it was empty, i put inside the code from but I suppose this is not a real installation :confused:

I will do what you propose and in case I will come back…

Thank you again for the time and help.


Hello Aitor,

I installed the cmseq using the command that you proposed but the problem insists.

conda install -p /site/ly/home/lbouchinha/Tools/conda_meta_strai_phlan -c bioconda cmseq
Collecting package metadata (repodata.json): …working… done
Solving environment: …working… done

The line from collection = cmseq.BamFile(i, index=True, minimumReadsAligning=8) is passing which means the cmseq is recognised but then at the line
results = collection.parallel_reference_free_consensus(ncores=nprocs, consensus_rule=cmseq.BamContig.majority_rule_polymorphicLoci) there is issue with the cmseq.BamContig

Any ideas?

Thank you in advance for your help.


So it worked! The problem was that I was using the whole path of python when running the command, instead of just python…

Thank you again :slight_smile:

Hi @annarerra
I’m glad you finally find a solution :slight_smile: Probably you were calling another python installation different than the one in your conda env. Moreover, when installing MetaPhlAn via conda, you can also run the scripts without calling python before the name of the script.