Run Metaphlan offline

We are trying to set up Metaphlan on an HPC computer that does not allow direct internet connection. We installed with conda via a proxy. However, any metaphlan command tries to download the database and gives an error.

I am trying to specify a local database with this --install --index command, but I still get the download/error.
How do I bypass the ‘check and install’ feature?

metaphlan --install --index mpa_v30_CHOCOPhlAn_201901 --bowtie2db /workgroups/bio/Data/Biobakery/ChocoPhlan/chocophlan/

(biobakery) [smbrow3@vnode170 ChocoPhlan]$ metaphlan --install --index mpa_v30_CHOCOPhlAn_201901 --bowtie2db /workgroups/bio/Data/Biobakery/ChocoPhlan/chocophlan/

Downloading file_list.txt

Traceback (most recent call last):
File “/workgroups/bio/apps/conda/envs/biobakery/bin/metaphlan”, line 10, in
sys.exit(main())
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/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 “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/site-packages/metaphlan/init.py”, line 263, in check_and_install_database
download(FILE_LIST, list_file_path)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/site-packages/metaphlan/init.py”, line 85, in download
reporthook=ReportHook().report)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/urllib/request.py”, line 247, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/urllib/request.py”, line 222, in urlopen
return opener.open(url, data, timeout)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/urllib/request.py”, line 525, in open
response = self._open(req, data)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/urllib/request.py”, line 543, in _open
‘_open’, req)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/urllib/request.py”, line 503, in _call_chain
result = func(*args)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/urllib/request.py”, line 1393, in https_open
context=self._context, check_hostname=self._check_hostname)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/urllib/request.py”, line 1350, in do_open
encode_chunked=req.has_header(‘Transfer-encoding’))
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/http/client.py”, line 1277, in request
self._send_request(method, url, body, headers, encode_chunked)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/http/client.py”, line 1323, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/http/client.py”, line 1272, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/http/client.py”, line 1032, in _send_output
self.send(msg)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/http/client.py”, line 972, in send
self.connect()
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/http/client.py”, line 1439, in connect
super().connect()
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/http/client.py”, line 944, in connect
(self.host,self.port), self.timeout, self.source_address)
File “/workgroups/bio/apps/conda/envs/biobakery/lib/python3.7/socket.py”, line 716, in create_connection
sock.connect(sa)

Hi Stuart,
You can download the database from here, build manually the index with bowtie2build and run metaphlan using --index and --bowtie2db (same as the command you used, but without --index). This will avoid the connection to internet to look for the database.

Hi there,

We are facing a similar error. But we have permission to access the online database via the proxy server, and are able to obtain files from http://cmprod1.cibio.unitn.it/biobakery3/metaphlan_databases via the proxy server. However, when we run metaphlan 3, we get this same error. We also tried to put the database in the directory we are running from and tell metaphlan to use the database in the directory to run the command but got the same error.

could you provide more detail on how to manually build the index. Additionally, could you confirm which database file to use? There are multiple file endings for v31 chocophlan for example.

Many thanks