# FileNotFoundError: \[Errno 2\]: Metaphlan 3.0.7

**URL:** <https://forum.biobakery.org/t/filenotfounderror-errno-2-metaphlan-3-0-7/1478>\
**Category:** MetaPhlAn\
**Created:** [December 29, 2020, 7:12pm UTC](https://forum.biobakery.org/t/filenotfounderror-errno-2-metaphlan-3-0-7/1478 "2020-12-29T19:12:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hpremathilake](https://avatars.discourse-cdn.com/v4/letter/h/977dab/32.png) [@hpremathilake](https://forum.biobakery.org/u/hpremathilake)\
**Post date:** [December 29, 2020, 7:12pm UTC](https://forum.biobakery.org/t/filenotfounderror-errno-2-metaphlan-3-0-7/1478/1 "2020-12-29T19:12:10Z")

</div>

## Hi, I’m getting the below-mentioned error when I’m trying to run Metaphlan v3 on paired-end metagenome sequencing data. I’m using the on-campus HPC that uses Slurm workload manager for job scheduling, to run metaphlan.

## File “/opt/metaphlan/3.0.7/anaconda3/bin/read\_fastx.py”, line 10, in sys.exit(main()) File “/opt/metaphlan/3.0.7/anaconda3/lib/python3.8/site-packages/metaphlan/utils/read\_fastx.py”, line 155, in main f\_nreads, f\_avg\_read\_length = read\_and\_write\_raw(f, opened=False, min\_len=min\_len) File “/opt/metaphlan/3.0.7/anaconda3/lib/python3.8/site-packages/metaphlan/utils/read\_fastx.py”, line 117, in read\_and\_write\_raw with fopen(fd) as inf: File “/opt/metaphlan/3.0.7/anaconda3/lib/python3.8/site-packages/metaphlan/utils/read\_fastx.py”, line 53, in fopen return open(fn) FileNotFoundError: [Errno 2] No such file or directory: ‘’

Below are the command line arguments I used to run metaphlan using the batch scheduler:

## Loading modules required for script commands

module load metaphlan

## Changing directories to where the fastq files are located

cd /scratch/hasitha/WaterProject/Metagenome

## Running metaphlan3.0

## metaphlan 68\_1.fq.gz,68\_2.fq.gz, --nproc 8 --input\_type fastq --bowtie2out /scratch/hasitha/WaterProject/Metagenome/metaphlan\_outputs/metagenome.bowtie2.bz2 --bowtie2db /scratch/hasitha/WaterProject/Metagenome/metaphlan\_outputs/ -o /scratch/hasitha/WaterProject/Metagenome/metaphlan\_outputs/profiled\_sample68.tx

Would greatly appreciate is someone can shed some light on solving this issue.

Thank you.  
Hasitha.

---

<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:** [December 30, 2020, 10:27am UTC](https://forum.biobakery.org/t/filenotfounderror-errno-2-metaphlan-3-0-7/1478/2 "2020-12-30T10:27:31Z")

</div>

Hi,  
You have a trailing comma in the input files that makes the command fail.  
`metaphlan 68_1.fq.gz,68_2.fq.gz,` should be `metaphlan 68_1.fq.gz,68_2.fq.gz`

---

<div class="post-metadata">

**Author:** ![hpremathilake](https://avatars.discourse-cdn.com/v4/letter/h/977dab/32.png) [@hpremathilake](https://forum.biobakery.org/u/hpremathilake)\
**Post date:** [December 30, 2020, 9:28pm UTC](https://forum.biobakery.org/t/filenotfounderror-errno-2-metaphlan-3-0-7/1478/3 "2020-12-30T21:28:42Z")

</div>

That was very sloppy of me to miss that. Ran without any issues after fixing that.  
Thank you very much for the help.

---

<div class="post-metadata">

**Author:** ![D11](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/d11/32/1224_2.png) [@D11](https://forum.biobakery.org/u/D11)\
**Post date:** [March 2, 2022, 3:23pm UTC](https://forum.biobakery.org/t/filenotfounderror-errno-2-metaphlan-3-0-7/1478/4 "2022-03-02T15:23:35Z")

</div>

Hello,

I reopen this help thread because I have obtained the same error described here (but I don’t have the trailing comma in the input files, solved by MetaPhlan developer @fbeghini in this issue) although the output obtained it seems correct (see below).

The standard error file contained the following error:

```auto
Traceback (most recent call last):
  File "/opt/conda/bin/read_fastx.py", line 10, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.7/site-packages/metaphlan/utils/read_fastx.py", line 167, in main
    f_nreads, f_avg_read_length = read_and_write_raw(f, opened=False, min_len=min_len, prefix_id=prefix_id)
  File "/opt/conda/lib/python3.7/site-packages/metaphlan/utils/read_fastx.py", line 128, in read_and_write_raw
    with fopen(fd) as inf:
  File "/opt/conda/lib/python3.7/site-packages/metaphlan/utils/read_fastx.py", line 56, in fopen
    return open(fn)
FileNotFoundError: [Errno 2] No such file or directory: ''

```

However the ouput for one sample, as example, their head it seems ok:

```auto
#mpa_v30_CHOCOPhlAn_201901
#/opt/conda/bin/metaphlan --index mpa_v30_CHOCOPhlAn_201901 --bowtie2_exe /home/david/bin/bowtie2-2.4.5-linux-x86_64/bowtie2 --bowtie2db /root/references/metagenomics_stable/metaphlan3 /root/clean_reads/AL1500.m1.fq.gz,/root/clean_reads/AL1500.m2.fq.gz -t rel_ab_w_read_stats --input_type fastq --nproc 8 --bowtie2out AL1500.metaphlan3.bowtie2
#SampleID Metaphlan_Analysis
#estimated_reads_mapped_to_known_clades:48621175
#clade_name clade_taxid relative_abundance coverage estimated_number_of_reads_from_the_clade
k__Bacteria 2 100.0 15.01793 43636845
k __Bacteria|p__ Firmicutes 2|1239 83.18411 12.49253 35516220

```

As I stated above, it’s seems that works properly but I’m worried about the error obtained in the standard error file.

Thanks for your hints,

David
