# Metaphlan3 running problem UnboundLocalError

**URL:** <https://forum.biobakery.org/t/metaphlan3-running-problem-unboundlocalerror/853>\
**Category:** MetaPhlAn\
**Created:** [August 13, 2020, 11:43pm UTC](https://forum.biobakery.org/t/metaphlan3-running-problem-unboundlocalerror/853 "2020-08-13T23:43:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boyan](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/boyan/32/394_2.png) [@Boyan](https://forum.biobakery.org/u/Boyan)\
**Post date:** [August 13, 2020, 11:43pm UTC](https://forum.biobakery.org/t/metaphlan3-running-problem-unboundlocalerror/853/1 "2020-08-13T23:43:06Z")

</div>

I had an error when running metaphlan3 in the first step.  
My command is “metaphlan SRR7563636\_1.fastq,SRR7563636\_2.fastq --input\_type fastq -s sams/SRR7563636.sam.bz2 --bowtie2out bowtie2/SRR7563636.bowtie2.bz2 -o profiles/SRR7563636\_profile.tsv”.

But it reported,  
Downloading [https://www.dropbox.com/sh/7qze7m7g9fe2xjg/AAA4XDP85WHon\_eHvztxkamTa/file\_list.txt?dl=1](https://www.dropbox.com/sh/7qze7m7g9fe2xjg/AAA4XDP85WHon_eHvztxkamTa/file_list.txt?dl=1)

**Warning: Unable to download** [https://www.dropbox.com/sh/7qze7m7g9fe2xjg/AAA4XDP85WHon\_eHvztxkamTa/file\_list.txt?dl=1](https://www.dropbox.com/sh/7qze7m7g9fe2xjg/AAA4XDP85WHon_eHvztxkamTa/file_list.txt?dl=1)  
Traceback (most recent call last):  
File “/gpfs/share/apps/python/cpu/3.6.5/bin/metaphlan”, line 8, in  
sys.exit(main())  
File “/gpfs/share/apps/python/cpu/3.6.5/lib/python3.6/site-packages/metaphlan/metaphlan.py”, line 916, in main  
pars[‘index’] = check\_and\_install\_database(pars[‘index’], pars[‘bowtie2db’], pars[‘bowtie2\_build’], pars[‘nproc’], pars[‘force\_download’])  
File “/gpfs/share/apps/python/cpu/3.6.5/lib/python3.6/site-packages/metaphlan/init.py”, line 271, in check\_and\_install\_database  
index = resolve\_latest\_database(bowtie2\_db, ls\_f[‘mpa\_latest’], force\_redownload\_latest)  
UnboundLocalError: local variable ‘ls\_f’ referenced before assignment

I can’t download the database by dropbox on our public server.  
Is there any way to solve or bypass this problem? For example, could I download the file and deposit it under some directory? Thank you so much!

---

<div class="post-metadata">

**Author:** ![fbeghini](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/fbeghini/32/81_2.png) [@fbeghini](https://forum.biobakery.org/u/fbeghini)\
**Post date:** [August 14, 2020, 5:41am UTC](https://forum.biobakery.org/t/metaphlan3-running-problem-unboundlocalerror/853/2 "2020-08-14T05:41:34Z")

</div>

Yes, you can download the database from Zenodo  
[https://zenodo.org/record/3957592#.XzYjcB7RZ-E](https://zenodo.org/record/3957592#.XzYjcB7RZ-E)

and run MetaPhlan with the `-x mpa_v30_CHOCOPhlAn_201901` parameter.  
You probably should update your installation, the latest version (3.0.2) automatically retrieves the database from Zenodo if Dropbox fails.

---

<div class="post-metadata">

**Author:** ![Boyan](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/boyan/32/394_2.png) [@Boyan](https://forum.biobakery.org/u/Boyan)\
**Post date:** [August 21, 2020, 10:58pm UTC](https://forum.biobakery.org/t/metaphlan3-running-problem-unboundlocalerror/853/3 "2020-08-21T22:58:21Z")

</div>

Thank you so much!!! I will try it.

---

<div class="post-metadata">

**Author:** ![Boyan](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/boyan/32/394_2.png) [@Boyan](https://forum.biobakery.org/u/Boyan)\
**Post date:** [August 22, 2020, 4:30am UTC](https://forum.biobakery.org/t/metaphlan3-running-problem-unboundlocalerror/853/4 "2020-08-22T04:30:21Z")

</div>

Hi,  
Sorry to bother you.  
I download the database and deposited it under the path “/gpfs/data/lilab/home/zhoub03/software/metaphlan3\_database/mpa\_v30\_CHOCOPhlAn\_201901”.  
I have tried to specify the database by using

1. “metaphlan SRR7563636\_1.fastq,SRR7563636\_2.fastq --input\_type fastq -s sams/SRR7563636.sam.bz2 **–bowtie2db /gpfs/data/lilab/home/zhoub03/software/metaphlan3\_database/mpa\_v30\_CHOCOPhlAn\_201901 -x mpa\_v30\_CHOCOPhlAn\_201901** --bowtie2out bowtie2/SRR7563636.bowtie2.bz2 -o profiles/SRR7563636\_profile.tsv”
2. “metaphlan SRR7563636\_1.fastq,SRR7563636\_2.fastq --input\_type fastq -s sams/SRR7563636.sam.bz2 **-x mpa\_v30\_CHOCOPhlAn\_201901** --bowtie2out bowtie2/SRR7563636.bowtie2.bz2 -o profiles/SRR7563636\_profile.tsv”
3. “metaphlan SRR7563636\_1.fastq,SRR7563636\_2.fastq --input\_type fastq -s sams/SRR7563636.sam.bz2 **–bowtie2db /gpfs/data/lilab/home/zhoub03/software/metaphlan3\_database/mpa\_v30\_CHOCOPhlAn\_201901** --bowtie2out bowtie2/SRR7563636.bowtie2.bz2 -o profiles/SRR7563636\_profile.tsv”

However, none of these commands worked. The tutorial just said, “Just download the .tar, .md5, and the mpa\_latest files and place them in the **metaphlan\_databases folder**.”  
So, where should I deposit the database? How can I let the metaphlan know where to find the database?  
Thank you so much!

---

<div class="post-metadata">

**Author:** ![fbeghini](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/fbeghini/32/81_2.png) [@fbeghini](https://forum.biobakery.org/u/fbeghini)\
**Post date:** [August 24, 2020, 7:29am UTC](https://forum.biobakery.org/t/metaphlan3-running-problem-unboundlocalerror/853/5 "2020-08-24T07:29:48Z")

</div>

Have you built the database with `bowtie2-build`?

---

<div class="post-metadata">

**Author:** ![Boyan](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/boyan/32/394_2.png) [@Boyan](https://forum.biobakery.org/u/Boyan)\
**Post date:** [August 28, 2020, 2:12pm UTC](https://forum.biobakery.org/t/metaphlan3-running-problem-unboundlocalerror/853/6 "2020-08-28T14:12:21Z")

</div>

Yes, I have built the database under “/gpfs/data/lilab/home/zhoub03/software/metaphlan3\_database/mpa\_v30\_CHOCOPhlAn\_201901” and obtained “mpa\_v30\_CHOCOPhlAn\_201901.1.bt2”. But when I ran “metaphlan SRR7563636\_1.fastq,SRR7563636\_2.fastq --input\_type fastq -s sams/SRR7563636.sam.bz2 **–bowtie2db /gpfs/data/lilab/home/zhoub03/software/metaphlan3\_database/mpa\_v30\_CHOCOPhlAn\_201901 --index mpa\_v30\_CHOCOPhlAn\_201901** --bowtie2out bowtie2/SRR7563636.bowtie2.bz2 -o profiles/SRR7563636\_profile.tsv”, it still reported the following error.

Downloading  
…  
Warning: Unable to download  
No MetaPhlAn BowTie2 database found (–index option)!  
Expecting location /gpfs/data/lilab/home/zhoub03/software/metaphlan3\_database/mpa\_v30\_CHOCOPhlAn\_201901/mpa\_v30\_CHOCOPhlAn\_201901  
Exiting…

Due to some internet safety issues, the metaphlan can’t automatically download the database. So where should I deposit the built database? How should I name the folder that contains the database?  
Thank you so much for your kindly help!

---

<div class="post-metadata">

**Author:** ![fbeghini](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/fbeghini/32/81_2.png) [@fbeghini](https://forum.biobakery.org/u/fbeghini)\
**Post date:** [August 28, 2020, 2:25pm UTC](https://forum.biobakery.org/t/metaphlan3-running-problem-unboundlocalerror/853/7 "2020-08-28T14:25:30Z")

</div>

> [@Boyan](#):
>
> “/gpfs/data/lilab/home/zhoub03/software/metaphlan3\_database/mpa\_v30\_CHOCOPhlAn\_201901” and obtained “mpa\_v30\_CHOCOPhlAn\_201901.1.bt2”

Is it the only file you got? You should have six `.bt2` files in the “/gpfs/data/lilab/home/zhoub03/software/metaphlan3\_database/mpa\_v30\_CHOCOPhlAn\_201901” folder

---

<div class="post-metadata">

**Author:** ![Boyan](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/boyan/32/394_2.png) [@Boyan](https://forum.biobakery.org/u/Boyan)\
**Post date:** [August 28, 2020, 6:40pm UTC](https://forum.biobakery.org/t/metaphlan3-running-problem-unboundlocalerror/853/8 "2020-08-28T18:40:07Z")

</div>

Thank you so much! The bowtie reference was not completely generated. Now, this problem has been solved.
