DADA2 in R (return code 1) error qiime2

Hello,

I encountered the following error after attempting to demultiplex my samples:

Plugin error from dada2:
An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more

I read a few other threads and thought that the error had to deal with my version of R and R studio, but I reinstalled R 4.2.0 and Rstudio 2022.02.3 as well as qiime2-2022.2 in miniconda3 but had the same error message.

Here is the code I attempted:

(qiime2-2022.2) LSB4239A-7DM:2022_June mholden3$ qiime dada2 denoise-paired \
--i-demultiplexed-seqs demux-paired-end-$name"".qza \
--p-trim-left-f 20 \
--p-trim-left-r 20 \
--p-trunc-len-f 226 \
--p-trunc-len-r 202 \
--o-table table-$name"".qza \
--o-representative-sequences rep-seqs-$name"".qza \
--o-denoising-stats denoising-stats-$name"".qza \
--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: run_dada_paired.R /var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/forward /var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/reverse /var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/output.tsv.biom /var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/track.tsv /var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/filt_f /var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/filt_r 226 202 20 20 2.0 2.0 2 12 independent consensus 1.0 1 1000000

R version 4.2.0 (2022-04-22) 
Loading required package: Rcpp
Error: package or namespace load failed for ‘dada2’ in library.dynam(lib, package, package.lib):
 shared object ‘rlang.so’ not found
Execution halted
Traceback (most recent call last):
  File "/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 279, in denoise_paired
    run_commands([cmd])
  File "/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 36, in run_commands
    subprocess.run(cmd, check=True)
  File "/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['run_dada_paired.R', '/var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/forward', '/var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/reverse', '/var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/output.tsv.biom', '/var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/track.tsv', '/var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/filt_f', '/var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/tmprvn44f98/filt_r', '226', '202', '20', '20', '2.0', '2.0', '2', '12', 'independent', 'consensus', '1.0', '1', '1000000']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/q2cli/commands.py", line 339, in __call__
    results = action(**arguments)
  File "<decorator-gen-451>", line 2, in denoise_paired
  File "/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
    outputs = self._callable_executor_(scope, callable_args,
  File "/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 391, in _callable_executor_
    output_views = self._callable(**view_args)
  File "/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 292, in denoise_paired
    raise Exception("An error was encountered while running DADA2"
Exception: An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.

Plugin error from dada2:

  An error was encountered while running DADA2 in R (return code 1), please inspect stdout and stderr to learn more.

See above for debug info.

I ran 'R -e ".libPaths()"' with the ouput

> .libPaths()
[1] "/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/R/library"
[2] "/Library/Frameworks/R.framework/Versions/4.2/Resources/library" 

I also ran env

(qiime2-2022.2) LSB4239A-7DM:2022_June mholden3$ env
AS=x86_64-apple-darwin13.4.0-as
R_TEXI2DVICMD=/usr/local/bin/texi2dvi
LN_S=ln -s
SED=/usr/bin/sed
LDFLAGS=-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib -L/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib
AR=x86_64-apple-darwin13.4.0-ar
RSTUDIO_WHICH_R=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/R
ac_cv_func_malloc_0_nonnull=yes
RSTUDIO_PANDOC=/Applications/RStudio.app/Contents/MacOS/quarto/bin
JAVA_LD_LIBRARY_PATH=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/server
R_INCLUDE_DIR=/Library/Frameworks/R.framework/Resources/include
R_PDFVIEWER=/usr/bin/open
R_STRIP_SHARED_LIB=strip -x
ac_cv_func_realloc_0_nonnull=yes
RSTUDIO_PROJ_NAME=
OBJC=x86_64-apple-darwin13.4.0-clang
HOST=x86_64-apple-darwin13.4.0
SHELL=/bin/zsh
TERM=xterm-256color
R_PRINTCMD=lpr
NM=x86_64-apple-darwin13.4.0-nm
PYTHONNOUSERSITE=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/python*/site-packages/
CPPFLAGS=-D_FORTIFY_SOURCE=2 -isystem /Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/include
TMPDIR=/var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/
PAGESTUFF=x86_64-apple-darwin13.4.0-pagestuff
R_RD4PDF=times,inconsolata,hyper
R_SYSTEM_ABI=macos,gcc,gxx,gfortran,gfortran
CONDA_SHLVL=2
LIPO=x86_64-apple-darwin13.4.0-lipo
RS_SHARED_SECRET=6ae6b427-9c6e-406e-8f15-b6e207538f01
R_PAPERSIZE=a4
CONDA_PROMPT_MODIFIER=(qiime2-2022.2) 
GSETTINGS_SCHEMA_DIR_CONDA_BACKUP=
SIZE=x86_64-apple-darwin13.4.0-size
NMEDIT=x86_64-apple-darwin13.4.0-nmedit
SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
OLDPWD=/Users/mholden3/Library/CloudStorage/Box-Box/Sequencing/2022_June
RSTUDIO=1
CXX_FOR_BUILD=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-clang++
INSTALL_NAME_TOOL=x86_64-apple-darwin13.4.0-install_name_tool
SEGEDIT=x86_64-apple-darwin13.4.0-segedit
GFORTRAN=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-gfortran
RSTUDIO_CONSOLE_WIDTH=71
SEG_HACK=x86_64-apple-darwin13.4.0-seg_hack
PYTHONIOENCODING=utf-8
RS_PPM_FD_READ=8
USER=mholden3
CLANGXX=x86_64-apple-darwin13.4.0-clang++
LIBTOOL=x86_64-apple-darwin13.4.0-libtool
COMMAND_MODE=unix2003
CONDA_TOOLCHAIN_BUILD=x86_64-apple-darwin13.4.0
FC_FOR_BUILD=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-gfortran
CONDA_EXE=/Users/mholden3/opt/miniconda3/bin/conda
OTOOL=x86_64-apple-darwin13.4.0-otool
TAR=/usr/bin/tar
RS_PPM_FD_WRITE=9
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.aJmdTT6drm/Listeners
R_ZIPCMD=/usr/bin/zip
DEBUG_FORTRANFLAGS=-march=core2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/include -march=core2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
__CF_USER_TEXT_ENCODING=0x1FA:0x0:0x0
CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/include
BASH_SILENCE_DEPRECATION_WARNING=1
PAGER=/usr/bin/less
STRINGS=x86_64-apple-darwin13.4.0-strings
CONDA_TOOLCHAIN_HOST=x86_64-apple-darwin13.4.0
R_GZIPCMD=/usr/bin/gzip
_CE_CONDA=
CHECKSYMS=x86_64-apple-darwin13.4.0-checksyms
CONDA_PREFIX_1=/Users/mholden3/opt/miniconda3
R_QPDF=/Library/Frameworks/R.framework/Resources/bin/qpdf
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin:/Users/mholden3/opt/miniconda3/condabin:/Applications/RStudio.app/Contents/MacOS/postback
GSETTINGS_SCHEMA_DIR=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/share/glib-2.0/schemas
MESON_ARGS=--buildtype release
RSTUDIO_USER_IDENTITY=mholden3
DEBUG_CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -Og -g -Wall -Wextra -isystem /Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/include
BUILD=x86_64-apple-darwin13.4.0
LD=x86_64-apple-darwin13.4.0-ld
__CFBundleIdentifier=org.rstudio.RStudio
CONDA_PREFIX=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2
F90=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-gfortran
PWD=/Users/mholden3/Library/CloudStorage/Box-Box/Sequencing/2022_June
JAVA_HOME=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2
STRIP=x86_64-apple-darwin13.4.0-strip
R_SHARE_DIR=/Library/Frameworks/R.framework/Resources/share
RSTUDIO_WINUTILS=bin/winutils
CMAKE_ARGS=-DCMAKE_AR=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-ar -DCMAKE_CXX_COMPILER_AR=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-ar -DCMAKE_C_COMPILER_AR=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-ar -DCMAKE_RANLIB=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-ranlib -DCMAKE_CXX_COMPILER_RANLIB=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-ranlib -DCMAKE_C_COMPILER_RANLIB=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-ranlib -DCMAKE_LINKER=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-ld -DCMAKE_STRIP=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-strip -DCMAKE_INSTALL_NAME_TOOL=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-install_name_tool -DCMAKE_LIBTOOL=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-libtool -DCMAKE_OSX_DEPLOYMENT_TARGET= -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
MPLBACKEND=Agg
EDITOR=vi
RSTUDIO_SESSION_ID=F7D14917
F95=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-gfortran
LANG=en_US.UTF-8
RSTUDIO_SESSION_PORT=49774
R_LIBS_SITE=/Library/Frameworks/R.framework/Resources/site-library
DEBUG_FFLAGS=-march=core2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/include -march=core2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
XPC_FLAGS=0x0
F77=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-gfortran
REDO_PREBINDING=x86_64-apple-darwin13.4.0-redo_prebinding
RSTUDIO_TERM=01B58F93
CXX=x86_64-apple-darwin13.4.0-clang++
CC_FOR_BUILD=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-clang
CLANG=x86_64-apple-darwin13.4.0-clang
XPC_SERVICE_NAME=0
R_BROWSER=/usr/bin/open
RMARKDOWN_MATHJAX_PATH=/Applications/RStudio.app/Contents/Resources/resources/mathjax-27
SSH_ASKPASS=rpostback-askpass
HISTCONTROL=ignoreboth
_CE_M=
HOME=/Users/mholden3
SHLVL=4
MAKE=make
FORTRANFLAGS=-march=core2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/include
CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/include
_CONDA_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_apple_darwin13_4_0
FC=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-gfortran
RS_RPOSTBACK_PATH=/Applications/RStudio.app/Contents/MacOS/rpostback
R_STRIP_STATIC_LIB=strip -S
LOGNAME=mholden3
R_UNZIPCMD=/usr/bin/unzip
CONDA_PYTHON_EXE=/Users/mholden3/opt/miniconda3/bin/python
build_alias=x86_64-apple-darwin13.4.0
LC_CTYPE=en_US.UTF-8
R_BZIPCMD=/usr/bin/bzip2
JAVA_HOME_CONDA_BACKUP=
CLICOLOR_FORCE=1
MPLENGINE=tkAgg
CONDA_DEFAULT_ENV=qiime2-2022.2
DEBUG_CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -Og -g -Wall -Wextra -isystem /Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/include
RANLIB=x86_64-apple-darwin13.4.0-ranlib
R_HOME=/Library/Frameworks/R.framework/Resources
PROMPT_COMMAND=echo -ne "\033]0;${PWD/#${HOME}/~}\007"
RSTUDIO_FALLBACK_LIBRARY_PATH=/var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T/rstudio-fallback-library-path-27h4ep
RSTUDIO_PROGRAM_MODE=desktop
GIT_ASKPASS=rpostback-askpass
CMAKE_PREFIX_PATH=:/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2
CC=x86_64-apple-darwin13.4.0-clang
SEG_ADDR_TABLE=x86_64-apple-darwin13.4.0-seg_addr_table
DISPLAY=:0
host_alias=x86_64-apple-darwin13.4.0
JAVA_LD_LIBRARY_PATH_BACKUP=
LDFLAGS_LD=-pie -headerpad_max_install_names -dead_strip_dylibs -rpath /Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib -L/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib
R_PLATFORM=x86_64-apple-darwin17.0
R_LIBS_USER=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/lib/R/library/
R_DOC_DIR=/Library/Frameworks/R.framework/Resources/doc
RSTUDIO_CONSOLE_COLOR=256
R_SESSION_TMPDIR=/var/folders/q_/69x7h1t90rzcvjxcn3sj3ts40000gt/T//RtmpSwvhmb
OBJC_FOR_BUILD=/Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/bin/x86_64-apple-darwin13.4.0-clang
FFLAGS=-march=core2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/mholden3/opt/miniconda3/envs/qiime2-2022.2/include
_=/usr/bin/env

Thanks for the help!
Maliea

Hi @Maliea,

I am wondering if there are competing versions of R or Rstudio in your existing conda environment that are creating this problem - let's have you try starting with a fresh conda environment and see if this fixes the issue. Please run the following commands on your machine:

conda deactivate

From here, you'll do a fresh install of QIIME 2 2022.2 - please follow the instructions here to install QIIME 2 within a conda environment based on your operating system.

Once the install has completed, go ahead and activate that environment and re-run the commands you shared above. Please let me know if you are still running into the same error, and we'll investigate further!

Cheers :lizard: