Errors running dada2: Rcpp not loading due to png.dylib version issue

Hello:
I'm running qiime 2022.8, command line on Apple iMac (os 11.7). Here is my command and the verbose output:

(qiime2-2022.8) Heather-Maughans-iMac:Oct2022_Combined_datasets heathermaughan$ qiime dada2 denoise-paired --i-demultiplexed-seqs Trich_Combined_seqs2.qza --p-trunc-len-f 150 --p-trunc-len-r 150 --o-representative-sequences rep-seqs-dada2-Trich.qza --o-table table-dada2-Trich.qza --o-denoising-stats stats-dada2-Trich-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.R --input_directory /var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/forward --input_directory_reverse /var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/reverse --output_path /var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/output.tsv.biom --output_track /var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/track.tsv --filtered_directory /var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/filt_f --filtered_directory_reverse /var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/filt_r --truncation_length 150 --truncation_length_reverse 150 --trim_left 0 --trim_left_reverse 0 --max_expected_errors 2.0 --max_expected_errors_reverse 2.0 --truncation_quality_score 2 --min_overlap 12 --pooling_method independent --chimera_method consensus --min_parental_fold 1.0 --allow_one_off False --num_threads 1 --learn_min_reads 1000000

R version 4.1.3 (2022-03-10)
Loading required package: Rcpp
Error: package or namespace load failed for ‘dada2’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/lib/R/library/png/libs/png.dylib':
dlopen(/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/lib/R/library/png/libs/png.dylib, 6): Library not loaded: @rpath/libpng16.16.dylib
Referenced from: /Users/heathermaughan/miniconda3/envs/qiime2-2022.8/lib/R/library/png/libs/png.dylib
Reason: Incompatible library version: png.dylib requires version 55.0.0 or later, but libpng16.16.dylib provides version 54.0.0
Execution halted
Traceback (most recent call last):
File "/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 308, in denoise_paired
run_commands([cmd])
File "/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 36, in run_commands
subprocess.run(cmd, check=True)
File "/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['run_dada.R', '--input_directory', '/var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/forward', '--input_directory_reverse', '/var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/reverse', '--output_path', '/var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/output.tsv.biom', '--output_track', '/var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/track.tsv', '--filtered_directory', '/var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/filt_f', '--filtered_directory_reverse', '/var/folders/8q/d5kdh6rd53q55m98gzylsxxr0000gn/T/tmpk1pp7m2h/filt_r', '--truncation_length', '150', '--truncation_length_reverse', '150', '--trim_left', '0', '--trim_left_reverse', '0', '--max_expected_errors', '2.0', '--max_expected_errors_reverse', '2.0', '--truncation_quality_score', '2', '--min_overlap', '12', '--pooling_method', 'independent', '--chimera_method', 'consensus', '--min_parental_fold', '1.0', '--allow_one_off', 'False', '--num_threads', '1', '--learn_min_reads', '1000000']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/lib/python3.8/site-packages/q2cli/commands.py", line 339, in call
results = action(**arguments)
File "", line 2, in denoise_paired
File "/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound_callable
outputs = self.callable_executor(scope, callable_args,
File "/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/lib/python3.8/site-packages/qiime2/sdk/action.py", line 381, in callable_executor
output_views = self._callable(**view_args)
File "/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/lib/python3.8/site-packages/q2_dada2/_denoise.py", line 321, 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 think something is wrong with R versions? Looking at other forum posts, I've tried

  1. heathermaughan$ cat ~/.Rprofile
    cat: /Users/heathermaughan/.Rprofile: No such file or directory

  2. Uninstalling RStudio. This did not help.

  3. Here is my env PATH
    PATH=/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/bin:/Users/heathermaughan/miniconda3/condabin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin:/opt/X11/bin:/Library/Apple/usr/bin:/usr/local/git/bin

Any help is much appreciated, thank you!
Heather

Hello @Heather_Maughan, have you tried removing and recreating your QIIME 2 conda environment?

I just tried removing and recreating the conda environment and get the same error message.

I did end up moving forward with the analysis using deblur instead, but it would be great to figure this out for future analyses.

Thank you.

With your QIIME 2 conda environment active, can you post the output from the command which R? It seems like the wrong R is being used somehow even though it seems like your path is correct. R can do some strange things to determine which executable to use.

(qiime2-2022.8) Heather-Maughans-iMac:Oct2022_Combined_datasets heathermaughan$ which R
/Users/heathermaughan/miniconda3/envs/qiime2-2022.8/bin/R

Ok, that sure looks like the correct R! A few things to try.

With the QIIME 2 conda active the entire time, can you run type R? If that shows a different R than the one you just saw using which can you run rehash and try type R again? If type R is still showing the incorrect R, can you post the contents of your .zshrc here?

If type R does show the correct R the first time, skip the other steps and just let me know here. It could be that it is choosing the correct R, but you don't have the dependency for some reason, but it would be odd for that to not be resolved by remaking the environment.

1 Like

R is the same:
(qiime2.2022.8) [email protected] Oct2022_Combined_datasets % type R

R is /Users/heathermaughan/miniconda3/envs/qiime2.2022.8/bin/R

(qiime2.2022.8) [email protected] Oct2022_Combined_datasets % which R

/Users/heathermaughan/miniconda3/envs/qiime2.2022.8/bin/R

1 Like

Just to clarify: By remaking the environment, I trashed the miniconda3/envs/qiime2-2022.8 folder and re-ran conda env create -n qiime2.2022.8 --file qiime2-2022.8-py38-osx-conda.yml

1 Like

Opening this up to other @moderators with more experience debugging this R stuff, because I'm really not sure.

1 Like

I wonder if another version of libpng is on the system outside of Conda, and that's confusing R.

I found similar errors when installing stuff with brew and this old conda issue.

Just to check, is this an M1 mac or an Intel mac? (You can check in :apple: > About this Mac)

Thanks for the reply. It is an Intel mac. I can try the suggestions in the "old conda issue" thread you linked.

1 Like

OK, good to know.

I'm not sure that conda thread will solve it. If this is an issue with the packages on conda-forge or bioconda we may have to wait for this bug to be fixed upstream before we download a fix...

1 Like

Ok, thank you for the information.

I wanted to pop in here and mention we're seeing a similar issue on our "canary" tests for the last release. I don't have a good solution, but we'll look into it.

Something that may be relevant is R was recently rebuilt on conda-forge for 4.2. It's likely the png library was a cran package, and something may be off there.

cc @lizgehret

2 Likes

Hi @Heather_Maughan,

We think this issue has been fixed conda-forge. There are now new builds of r-png available which pin libpng to a compatible version.

You should be able to remove your qiime2 environment and reinstall.
We're hoping to find this build after the reinstall (conda list r-png):

r-png   0.1_7-r41h815d134_1006

(it should end in 1006 rather than 1005)

If the reinstall still fetches the wrong one, then try clearing your conda cache with
conda clean --all and try again.

Hopefully we found the root of this issue.

Thanks for looking in to this. Unfortunately I'm still seeing the '1005' version:
(qiime2-2022.8) [email protected] Oct2022_Combined_datasets % conda list r-png

packages in environment at /Users/heathermaughan/miniconda3/envs/qiime2-2022.8:

Name Version Build Channel

r-png 0.1_7 r41h815d134_1005 conda-forge

I did clear the conda cache and noticed then that r-png-0.1_7 was downloaded and extracted as part of the new env create. But still the wrong one. ?

Hi @Heather_Maughan,

It's weird it seems like it downloaded it and then ignored it. Conda sometimes doesn't do what I expect, so when that happens I find deleting the pkg cache and implicated environment manually can help.

As always, be careful with rm commands, but these ought to be pretty harmless:

rm -r /Users/heathermaughan/miniconda3/pkgs  # this is the cache
rm -r /Users/heathermaughan/miniconda3/envs/qiime2-2022.8  # the environmen

(If you get a bunch of questions about a protected file, cancel the command (ctrl-c [not cmd]) and re-run with an extra -f flag for "force")

Then try again, and hopefully we end up with the correct latest build.

2 Likes