error 71 kraken2

I've been following the tutorial at q2-books/q2-shotgun/q2-shotgun/00-tutorial.md at main · caporaso-lab/q2-books · GitHub to classify my sequences using kraken and the PlusPF database. Creating the indices [Importing Kraken2 and bracken databases into qiime2!] seemed to work fine, but I can't classify.

When I try to run
qiime moshpit classify-kraken2 --i-seqs paired-end-demux.qza --i-kraken2-db k2_ppf.qza --p-threads 4 --output-dir kraken_ppf --p-report-minimizer-data
I get the error message:
Plugin error from moshpit: An error was encountered while running Kraken 2, (return code 71), please inspect stdout and stderr to learn more. Debug info has been saved to /tmp/qiime2-q2cli-err-kdmkgpta.log
I can't find stdout, stderr or a log file anywhere in my system, so does anyone know what this error could mean?

Thanks for your help!

Hi @Karim_Talaat ,

Please re-run this command with the --verbose flag added to the end of your command — then the error message will be written to stdout instead of to a log file. Please share the full error message here and we can take a look.

Thanks!

1 Like

Thanks for your reply, i ran the --verbose and the I got the following error message:
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: kraken2 --threads 40 --confidence 0.6 --minimum-base-quality 20 --minimum-hit-groups 2 --report-minimizer-data --db /tmp/qiime2/karim/data/cef867ed-d396-465d-8b97-664cfb961ffc/data --paired --report /tmp/q2-Kraken2ReportDirectoryFormat-5t_wm5yv/A3.report.txt --output /tmp/q2-Kraken2OutputDirectoryFormat-x3fk_nap/A3.output.txt /tmp/qiime2/karim/data/59399d99-7dbf-4ecd-a5f9-b607c5de53e8/data/A3_0_L001_R1_001.fastq.gz /tmp/qiime2/karim/data/59399d99-7dbf-4ecd-a5f9-b607c5de53e8/data/A3_6_L001_R2_001.fastq.gz

Loading database information...Failed attempt to allocate 16000000000bytes;
you may not have enough free memory to load this database.
If your computer has enough RAM, perhaps reducing memory usage from
other programs could help you load this database?
classify: unable to allocate hash table memory
Traceback (most recent call last):
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/q2_moshpit/kraken2/classification.py", line 180, in classify_kraken2_helper
run_command(cmd=cmd, verbose=True)
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/q2_moshpit/_utils.py", line 32, in run_command
subprocess.run(cmd, check=True, **kwargs)
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['kraken2', '--threads', '40', '--confidence', '0.6', '--minimum-base-quality', '20', '--minimum-hit-groups', '2', '--report-minimizer-data', '--db', '/tmp/qiime2/karim/data/cef867ed-d396-465d-8b97-664cfb961ffc/data', '--paired', '--report', '/tmp/q2-Kraken2ReportDirectoryFormat-5t_wm5yv/A3.report.txt', '--output', '/tmp/q2-Kraken2OutputDirectoryFormat-x3fk_nap/A3.output.txt', '/tmp/qiime2/karim/data/59399d99-7dbf-4ecd-a5f9-b607c5de53e8/data/A3_0_L001_R1_001.fastq.gz', '/tmp/qiime2/karim/data/59399d99-7dbf-4ecd-a5f9-b607c5de53e8/data/A3_6_L001_R2_001.fastq.gz']' returned non-zero exit status 71.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/q2cli/commands.py", line 520, in call
results = self._execute_action(
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/q2cli/commands.py", line 586, in _execute_action
results = action(**arguments)
File "", line 2, in classify_kraken2
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 342, in bound_callable
outputs = self.callable_executor(
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 647, in callable_executor
outputs = self._callable(scope.ctx, **view_args)
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/q2_moshpit/kraken2/classification.py", line 94, in classify_kraken2
(kraken2_report, kraken2_output) = _classify_kraken2(
File "", line 2, in _classify_kraken2
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/qiime2/sdk/context.py", line 143, in deferred_action
return action_obj._bind(
File "", line 2, in _classify_kraken2
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 342, in bound_callable
outputs = self.callable_executor(
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 566, in callable_executor
output_views = self._callable(**view_args)
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/q2_moshpit/kraken2/classification.py", line 131, in _classify_kraken2
return classify_kraken2_helper(seqs, common_args)
File "/home/karim/miniconda3/envs/qiime2-shotgun-2024.2/lib/python3.8/site-packages/q2_moshpit/kraken2/classification.py", line 183, in classify_kraken2_helper
raise Exception(
Exception: An error was encountered while running Kraken 2, (return code 71), please inspect stdout and stderr to learn more.

Plugin error from moshpit:

An error was encountered while running Kraken 2, (return code 71), please inspect stdout and stderr to learn more.

See above for debug info.

Thank you for the full error message. Please see this part of the error message:

You will need to increase RAM capacity as noted there.

Good luck!

Thanks and noted dear Nicholas. I will upgrade the RAM capacity and come back you.
Really Appreciated

Dear Nicholas,
I have managed the RAM capacity issue. Then I ran the following command qiime moshpit classify-kraken2 --i-seqs demux.qza --i-kraken2-db k2/kraken2.qza --p-threads 40 --p-confidence 0.6 --p-minimum-base-quality 20 --output-dir kraken-k2pf-c60-mbq20-reads --p-report-minimizer-data --verbose
I got 0 reads classified and 100% Unclassified
Command: kraken2 --threads 40 --confidence 0.6 --minimum-base-quality 20 --minimum-hit-groups 2 --report-minimizer-data --db /tmp/qiime2/karim/data/0a2e9b94-90d8-4380-ba58-cbf605c6635c/data --paired --report /tmp/q2-Kraken2ReportDirectoryFormat-3o86p48h/A3.report.txt --output /tmp/q2-Kraken2OutputDirectoryFormat-2tgoymqi/A3.output.txt /tmp/qiime2/karim/data/9182f8ed-8082-48b6-b975-6941574b3286/data/A3_0_L001_R1_001.fastq.gz /tmp/qiime2/karim/data/9182f8ed-8082-48b6-b975-6941574b3286/data/A3_6_L001_R2_001.fastq.gz

Loading database information... done.
36518706 sequences (10955.61 Mbp) processed in 761.330s (2878.0 Kseq/m, 863.41 Mbp/m).
0 sequences classified (0.00%)
36518706 sequences unclassified (100.00%)

Hi @Karim_Talaat ,

I suggest checking your query and reference sequences to make sure that you have selected the right reference database for your organisms of interest, and that your query sequences look okay (e.g., high-quality sequence data).

You could also see this topic, which reported a similar issue and a solution:

1 Like

Hi Nicholas,
As I am working on gut microbiome (WGS), I downloaded standard database, however the percentage of classified reads and contigs are relatively low. Is there any option to increase these percentages ?
iime moshpit classify-kraken2 --i-seqs megahit-contigs.qza --i-kraken2-db /media/karim/External/Ubuntu-May/k2/kraken2.qza --p-threads 40 --p-confidence 0.6 --output-dir kraken-k2pf-c60-contigs/ --p-report-minimizer-data --verbose
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: kraken2 --threads 40 --confidence 0.6 --minimum-base-quality 0 --minimum-hit-groups 2 --report-minimizer-data --db /tmp/qiime2/karim/data/da34fc9e-cb5a-4213-a546-cce90619a2d4/data --report /tmp/q2-Kraken2ReportDirectoryFormat-ys0ocuq6/A3.report.txt --output /tmp/q2-Kraken2OutputDirectoryFormat-tl2_q4so/A3.output.txt /tmp/qiime2/karim/data/7545c058-5262-44f8-abba-a91fb3a0197d/data/A3_contigs.fa

Loading database information... done.
239680 sequences (371.20 Mbp) processed in 8.673s (1658.1 Kseq/m, 2567.94 Mbp/m).
73638 sequences classified (30.72%)
166042 sequences unclassified (69.28%)
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: kraken2 --threads 40 --confidence 0.6 --minimum-base-quality 0 --minimum-hit-groups 2 --report-minimizer-data --db /tmp/qiime2/karim/data/da34fc9e-cb5a-4213-a546-cce90619a2d4/data --report /tmp/q2-Kraken2ReportDirectoryFormat-_3axumjp/A5.report.txt --output /tmp/q2-Kraken2OutputDirectoryFormat-4z90te83/A5.output.txt /tmp/qiime2/karim/data/824d40a9-34c8-4276-b1a6-5744c400bd35/data/A5_contigs.fa

Loading database information... done.
702957 sequences (721.14 Mbp) processed in 10.220s (4126.8 Kseq/m, 4233.52 Mbp/m).
148967 sequences classified (21.19%)
553990 sequences unclassified (78.81%)
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: kraken2 --threads 40 --confidence 0.6 --minimum-base-quality 0 --minimum-hit-groups 2 --report-minimizer-data --db /tmp/qiime2/karim/data/da34fc9e-cb5a-4213-a546-cce90619a2d4/data --report /tmp/q2-Kraken2ReportDirectoryFormat-ka3ux2wh/A7.report.txt --output /tmp/q2-Kraken2OutputDirectoryFormat-vy4c9391/A7.output.txt /tmp/qiime2/karim/data/11dc8003-5353-4090-b75f-4280fc0b2ebb/data/A7_contigs.fa

Loading database information... done.
323765 sequences (445.41 Mbp) processed in 8291.179s (2.3 Kseq/m, 3.22 Mbp/m).
105807 sequences classified (32.68%)
217958 sequences unclassified (67.32%)
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: kraken2 --threads 40 --confidence 0.6 --minimum-base-quality 0 --minimum-hit-groups 2 --report-minimizer-data --db /tmp/qiime2/karim/data/da34fc9e-cb5a-4213-a546-cce90619a2d4/data --report /tmp/q2-Kraken2ReportDirectoryFormat-7i3_yobv/D1.report.txt --output /tmp/q2-Kraken2OutputDirectoryFormat-5dh0f8ep/D1.output.txt /tmp/qiime2/karim/data/aee2d028-b4dc-43ca-bdf7-fac453f5e8a1/data/D1_contigs.fa

Loading database information... done.
152432 sequences (196.45 Mbp) processed in 2606.837s (3.5 Kseq/m, 4.52 Mbp/m).
66792 sequences classified (43.82%)
85640 sequences unclassified (56.18%)
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: kraken2 --threads 40 --confidence 0.6 --minimum-base-quality 0 --minimum-hit-groups 2 --report-minimizer-data --db /tmp/qiime2/karim/data/da34fc9e-cb5a-4213-a546-cce90619a2d4/data --report /tmp/q2-Kraken2ReportDirectoryFormat-nndpfebw/D4.report.txt --output /tmp/q2-Kraken2OutputDirectoryFormat-kpnut20e/D4.output.txt /tmp/qiime2/karim/data/37bcaf13-c874-4c64-ba76-bf5575d0e115/data/D4_contigs.fa

Loading database information... done.
417894 sequences (503.85 Mbp) processed in 5.628s (4454.8 Kseq/m, 5371.15 Mbp/m).
102856 sequences classified (24.61%)
315038 sequences unclassified (75.39%)
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: kraken2 --threads 40 --confidence 0.6 --minimum-base-quality 0 --minimum-hit-groups 2 --report-minimizer-data --db /tmp/qiime2/karim/data/da34fc9e-cb5a-4213-a546-cce90619a2d4/data --report /tmp/q2-Kraken2ReportDirectoryFormat-4k5nctla/D9.report.txt --output /tmp/q2-Kraken2OutputDirectoryFormat-cgj47ism/D9.output.txt /tmp/qiime2/karim/data/5488f0ec-b6d7-436d-9953-2b76f105c97f/data/D9_contigs.fa

Loading database information... done.
222666 sequences (313.00 Mbp) processed in 5.754s (2322.0 Kseq/m, 3263.97 Mbp/m).
63223 sequences classified (28.39%)
159443 sequences unclassified (71.61%)

Please see the topic that I linked above — see the solution near the end about adjusting the confidence level.

1 Like

thanks Nicholas will take a look.
Really appreciated

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.