The bioBakery help forum

Issue with bowtie2db trying to install MetaPhIan3

Hi! I installed MetaPhlAn using conda:

conda create -n env_metaflan
conda activate env_metaflan
conda install -c bioconda python=3.7 metaphlan

#checked installed versions of requirements:
conda list -n env_metaflan
bowtie 2.4.2
numpy 1.20.1
biopython 1.78

#Following this recommendation: “If you have installed MetaPhlAn using Anaconda, it is advised to install the database in a folder outside the Conda environment.” I tried:
$ metaphlan --install --bowtie2db MetaPhIan

#I get this error message:
Downloading MetaPhlAn database
Please note due to the size this might take a few minutes

File MetaPhIan/mpa_v30_CHOCOPhlAn_201901.tar already present!

File MetaPhIan/mpa_v30_CHOCOPhlAn_201901.md5 already present!
Traceback (most recent call last):
File “/root/miniconda3/envs/env_metaflan/bin/metaphlan”, line 10, in
sys.exit(main())
File “/root/miniconda3/envs/env_metaflan/lib/python3.7/site-packages/metaphlan/metaphlan.py”, line 925, in main
pars[‘index’] = check_and_install_database(pars[‘index’], pars[‘bowtie2db’], pars[‘bowtie2_build’], pars[‘nproc’], pars[‘force_download’])
File “/root/miniconda3/envs/env_metaflan/lib/python3.7/site-packages/metaphlan/init.py”, line 301, in check_and_install_database
download_unpack_tar(index, bowtie2_db, bowtie2_build, nproc, use_zenodo)
File “/root/miniconda3/envs/env_metaflan/lib/python3.7/site-packages/metaphlan/init.py”, line 180, in download_unpack_tar
bt2_build_output = subp.check_output([bowtie2_build, ‘–usage’], stderr=subp.STDOUT)
File “/root/miniconda3/envs/env_metaflan/lib/python3.7/subprocess.py”, line 411, in check_output
**kwargs).stdout
File “/root/miniconda3/envs/env_metaflan/lib/python3.7/subprocess.py”, line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘[‘bowtie2-build’, ‘–usage’]’ returned non-zero exit status 127.

Any suggestions?
Thank you

#With conda list I see this:
metaphlan 3.0.7 pyh7b7c402_0 bioconda

I tried creating another conda env but it didn’t work. Also, without installing the database with $ metaphlan --install --bowtie2db MetaPhIan; I tried doing the tutorial and I get this similar error:

:/Emilia/Metaphlan/metaphlan_analysis# metaphlan SRS014476-Supragingival_plaque.fasta.gz --input_ty
pe fasta > SRS014476-Supragingival_plaque_profile.txt

Downloading MetaPhlAn database
Please note due to the size this might take a few minutes

File /root/miniconda3/envs/env_metaflan/lib/python3.7/site-packages/metaphlan/metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.tar already present!

File /root/miniconda3/envs/env_metaflan/lib/python3.7/site-packages/metaphlan/metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.md5 already present!
Traceback (most recent call last):
File “/root/miniconda3/envs/env_metaflan/bin/metaphlan”, line 10, in
sys.exit(main())
File “/root/miniconda3/envs/env_metaflan/lib/python3.7/site-packages/metaphlan/metaphlan.py”, line 925, in main
pars[‘index’] = check_and_install_database(pars[‘index’], pars[‘bowtie2db’], pars[‘bowtie2_build’], pars[‘nproc’], pars[‘force_download’])
File “/root/miniconda3/envs/env_metaflan/lib/python3.7/site-packages/metaphlan/init.py”, line 301, in check_and_install_database
download_unpack_tar(index, bowtie2_db, bowtie2_build, nproc, use_zenodo)
File “/root/miniconda3/envs/env_metaflan/lib/python3.7/site-packages/metaphlan/init.py”, line 180, in download_unpack_tar
bt2_build_output = subp.check_output([bowtie2_build, ‘–usage’], stderr=subp.STDOUT)
File “/root/miniconda3/envs/env_metaflan/lib/python3.7/subprocess.py”, line 411, in check_output
**kwargs).stdout
File “/root/miniconda3/envs/env_metaflan/lib/python3.7/subprocess.py”, line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘[‘bowtie2-build’, ‘–usage’]’ returned non-zero exit status 127.

HI!
Could you try to install libtbb2 and run again? Looks like bowtie2 needs a TBB to run, but it is not installed or some other issues.

sudo apt install libtbb2

I wasn’t able to install it since I am working on the cluster, but it should work on local machine

thank you! I think you are right. If it’s useful for anyone else, finally it worked doing this:
apt install libtbb-dev
apt install bowtie2

Another solution in case you cannot sudo:

  1. Download already compiled bowtie2: Releases · BenLangmead/bowtie2 · GitHub
  2. Unzip and apply chmod -R 757 to directory with bowtie2
  3. Run metaphlan with --bowtie2_exe path_to/bowtie2 parameter

Hello,

I contact you because I have the same problem to run --install --bowtie2 after installing metaphlan with conda.
Iam on a hpc so no sudo possible. I downloaded bowtie2 and use this command

metaphlan --install  --bowtie2db /data/scratch/btx246/Taxonomic_Assignment/MetaPhlAn/ --bowtie2_exe /data/home/btx246/bowtie2-2.4.4/bowtie2-build

I still have error message:

Downloading MetaPhlAn database
Please note due to the size this might take a few minutes

File /data/scratch/btx246/Taxonomic_Assignment/MetaPhlAn/file_list.txt already present!

File /data/scratch/btx246/Taxonomic_Assignment/MetaPhlAn/mpa_v30_CHOCOPhlAn_201901.tar already present!

File /data/scratch/btx246/Taxonomic_Assignment/MetaPhlAn/mpa_v30_CHOCOPhlAn_201901.md5 already present!
Traceback (most recent call last):
  File "/data/home/btx246/.conda/envs/nico/bin/metaphlan", line 10, in <module>
    sys.exit(main())
  File "/data/home/btx246/.conda/envs/nico/lib/python3.6/site-packages/metaphlan/metaphlan.py", line 1187, in main
    pars['index'] = check_and_install_database(pars['index'], pars['bowtie2db'], pars['bowtie2_build'], pars['nproc'], pars['force_download'])
  File "/data/home/btx246/.conda/envs/nico/lib/python3.6/site-packages/metaphlan/metaphlan.py", line 610, in check_and_install_database
    download_unpack_tar(FILE_LIST, index, bowtie2_db, bowtie2_build, nproc)
  File "/data/home/btx246/.conda/envs/nico/lib/python3.6/site-packages/metaphlan/metaphlan.py", line 527, in download_unpack_tar
    bt2_build_output = subp.check_output([bowtie2_build, '--usage'], stderr=subp.STDOUT)
  File "/data/home/btx246/.conda/envs/nico/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/data/home/btx246/.conda/envs/nico/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bowtie2-build', '--usage']' returned non-zero exit status 127.

Do you have an idea to fix it?

Thanks for help
regards

Hi!
Here is another person with the same problem

Fixed it by replacing bowtie executive files (in that case no need to add path to exe file in metaphlan commands). See the post by the link for commands.

Bowtie prebuilded can be obtained here:

Thanks!
I am trying with

metaphlan --install  --bowtie2db /data/scratch/btx246/Taxonomic_Assignment/MetaPhlAn/ --bowtie2_build /data/home/btx246/bowtie2-2.4.4/bowtie2-build

Seems to work.

I am going back to MetaPhlan3

I have tried the command

 (biobakery) btx246@nxv37:/data/scratch/btx246/MetaPhlan$ metaphlan --install --bowtie2_build /data/home/btx246/bowtie2-2.4.4/bowtie2-build 

But I still have error:

Downloading MetaPhlAn database
Please note due to the size this might take a few minutes

File /data/home/btx246/.conda/envs/biobakery/lib/python3.7/site-packages/metaphlan/metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.tar already present!

File /data/home/btx246/.conda/envs/biobakery/lib/python3.7/site-packages/metaphlan/metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.md5 already present!

Building Bowtie2 indexes
Fatal error running '/data/home/btx246/bowtie2-2.4.4/bowtie2-build --quiet --threads 4 -f /data/home/btx246/.conda/envs/biobakery/lib/python3.7/site-packages/metaphlan/metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.fna /data/home/btx246/.conda/envs/biobakery/lib/python3.7/site-packages/metaphlan/metaphlan_databases/mpa_v30_CHOCOPhlAn_201901'
Error message: 'Command '['/data/home/btx246/bowtie2-2.4.4/bowtie2-build', '--quiet', '--threads', '4', '-f', '/data/home/btx246/.conda/envs/biobakery/lib/python3.7/site-packages/metaphlan/metaphlan_databases/mpa_v30_CHOCOPhlAn_201901.fna', '/data/home/btx246/.conda/envs/biobakery/lib/python3.7/site-packages/metaphlan/metaphlan_databases/mpa_v30_CHOCOPhlAn_201901']' returned non-zero exit status 249.'