Unable to run ANCOM-BC plugin, unable to load gsl.dylib

Hi, I am trying to run ANCOM-BC but the following error (below) keeps popping up. The error says that I cannot load "'/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/R/library/gsl/libs/gsl.dylib':". I'm confused because when I am able to manually find this file in my folders following the same path. I have tried downloading and reinstalling miniconda3 and my qiime environment.

Update 6/16: just out of curiosity I tried running it in a qiime2 v2024.2 instead of v2025.2 and the same error showed up.

/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_composition/_ancombc.py:77: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
  term_alpha_value = (metadata.get_column(term)
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_ancombc.R --inp_abundances_path /var/folders/rt/6vtjnzqd64qbxyg4_fpkknjm0000gn/T/tmpc6d3msb7/input.biom.tsv --inp_metadata_path /var/folders/rt/6vtjnzqd64qbxyg4_fpkknjm0000gn/T/tmpc6d3msb7/input.map.txt --md_column_types {"Plate": "categorical", "Name": "categorical", "Infected": "categorical", "Oil": "categorical", "Trauma": "categorical", "CollectionDate": "categorical", "MultipleTimePoints": "categorical", "RemoveDuplicates": "categorical", "CollectionMonth": "numeric", "CollectionDay": "numeric", "CaptureDate": "categorical", "CaptureMonth": "numeric", "CaptureDay": "numeric", "County": "categorical", "City": "categorical", "Latitude": "numeric", "Longitude": "numeric", "Sex": "categorical", "WeightKg": "numeric", "Length": "numeric", "Status": "categorical", "Blank": "categorical", "Duplicate": "categorical", "SampleType": "categorical", "Reads": "numeric"} --formula Sex --p_adj_method holm --prv_cut 0.1 --lib_cut 0 --reference_levels ['Sex::Female'] --tol 1e-05 --max_iter 100 --conserve False --alpha 0.05 --output_loaf /var/folders/rt/6vtjnzqd64qbxyg4_fpkknjm0000gn/T/q2-DataLoafPackageDirFmt-ga3vswl8

── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
βœ” dplyr     1.1.4     βœ” readr     2.1.5
βœ” forcats   1.0.0     βœ” stringr   1.5.1
βœ” ggplot2   3.5.1     βœ” tibble    3.2.1
βœ” lubridate 1.9.3     βœ” tidyr     1.3.1
βœ” purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
βœ– dplyr::filter() masks stats::filter()
βœ– dplyr::lag()    masks stats::lag()
β„Ή Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Error: package or namespace load failed for β€˜ANCOMBC’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/R/library/gsl/libs/gsl.dylib':
  dlopen(/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/R/library/gsl/libs/gsl.dylib, 0x0006): Library not loaded: @rpath/libgsl.25.dylib
  Referenced from: <5451EAF0-839D-3B5C-80E8-426E99B788AD> /Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/R/library/gsl/libs/gsl.dylib
  Reason: tried: '/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/R/library/gsl/libs/../../../lib/libgsl.25.dylib' (no such file), '/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/R/library/gsl/libs/../../../../libgsl.25.dylib' (no such file), '/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/R/library/gsl/libs/../../../lib/libgsl.25.dylib' (no such file), '/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/R/library/
8: stop(msg, call. = FALSE, domain = NA)
7: value[[3L]](cond)
6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
5: tryCatchList(expr, classes, parentenv, handlers)
4: tryCatch({
       attr(package, "LibPath") <- which.lib.loc
       ns <- loadNamespace(package, lib.loc)
       env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
   }, error = function(e) {
       P <- if (!is.null(cc <- conditionCall(e))) 
           paste(" in", deparse(cc)[1L])
       else ""
       msg <- gettextf("package or namespace load failed for %s%s:\n %s", 
           sQuote(package), P, conditionMessage(e))
       if (logical.return && !quietly) 
           message(paste("Error:", msg), domain = NA)
       else stop(msg, call. = FALSE, domain = NA)
   })
3: library(ANCOMBC)
2: withCallingHandlers(expr, warning = function(w) if (inherits(w, 
       classes)) tryInvokeRestart("muffleWarning"))
1: suppressWarnings(library(ANCOMBC))
Traceback (most recent call last):
  File "/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_composition/_ancombc.py", line 255, in _ancombc
    run_commands([cmd])
  File "/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_composition/_ancombc.py", line 32, in run_commands
    subprocess.run(cmd, check=True)
  File "/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['run_ancombc.R', '--inp_abundances_path', '/var/folders/rt/6vtjnzqd64qbxyg4_fpkknjm0000gn/T/tmpc6d3msb7/input.biom.tsv', '--inp_metadata_path', '/var/folders/rt/6vtjnzqd64qbxyg4_fpkknjm0000gn/T/tmpc6d3msb7/input.map.txt', '--md_column_types', '{"Plate": "categorical", "Name": "categorical", "Infected": "categorical", "Oil": "categorical", "Trauma": "categorical", "CollectionDate": "categorical", "MultipleTimePoints": "categorical", "RemoveDuplicates": "categorical", "CollectionMonth": "numeric", "CollectionDay": "numeric", "CaptureDate": "categorical", "CaptureMonth": "numeric", "CaptureDay": "numeric", "County": "categorical", "City": "categorical", "Latitude": "numeric", "Longitude": "numeric", "Sex": "categorical", "WeightKg": "numeric", "Length": "numeric", "Status": "categorical", "Blank": "categorical", "Duplicate": "categorical", "SampleType": "categorical", "Reads": "numeric"}', '--formula', 'Sex', '--p_adj_method', 'holm', '--prv_cut', '0.1', '--lib_cut', '0', '--reference_levels', "['Sex::Female']", '--tol', '1e-05', '--max_iter', '100', '--conserve', 'False', '--alpha', '0.05', '--output_loaf', '/var/folders/rt/6vtjnzqd64qbxyg4_fpkknjm0000gn/T/q2-DataLoafPackageDirFmt-ga3vswl8']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/commands.py", line 520, in __call__
    results = self._execute_action(
  File "/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/commands.py", line 581, in _execute_action
    results = action(**arguments)
  File "<decorator-gen-19>", line 2, in ancombc
  File "/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 342, in bound_callable
    outputs = self._callable_executor_(
  File "/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 576, in _callable_executor_
    output_views = self._callable(**view_args)
  File "/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_composition/_ancombc.py", line 41, in ancombc
    return _ancombc(
  File "/Users/emilyyu/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_composition/_ancombc.py", line 257, in _ancombc
    raise Exception('An error was encountered while running ANCOM-BC'
Exception: An error was encountered while running ANCOM-BC in R (return code 1), please inspect stdout and stderr to learn more.

Here is the code I used to run ANCOM-BC

# Step 4: ANCOM-BC, differential abundance analyses 
## Applying pre-trained classifier to sequences and then generating a visualization of the resulting mapping from sequence to taxonomy.
wget \
  -O "gg-13-8-99-515-806-nb-classifier.qza" \
  "https://data.qiime2.org/2023.2/common/gg-13-8-99-515-806-nb-classifier.qza"

qiime feature-classifier classify-sklearn \
  --i-classifier gg-13-8-99-515-806-nb-classifier.qza \
  --i-reads rep-seqs-merged-NES-44.qza \
  --o-classification taxonomy.qza

qiime metadata tabulate \
  --m-input-file taxonomy.qza \
  --o-visualization taxonomy.qzv

qiime taxa barplot \
  --i-table table-merged-NES-44.qza \
  --i-taxonomy taxonomy.qza \
  --m-metadata-file metadata-44.tsv \
  --o-visualization taxa-bar-plots.qzv

## Collapsing table to genus and class level 
qiime taxa collapse \
  --i-table table-merged-NES-44.qza \
  --i-taxonomy taxonomy.qza \
  --p-level 6 \
  --o-collapsed-table table-l6.qza

qiime feature-table summarize \
  --i-table table-l6.qza \
  --o-visualization table-l6.qzv \
  --m-sample-metadata-file metadata-44.tsv

qiime taxa collapse \
  --i-table table-merged-NES-44.qza \
  --i-taxonomy taxonomy.qza \
  --p-level 3 \
  --o-collapsed-table table-l3.qza

qiime feature-table summarize \
  --i-table table-l3.qza \
  --o-visualization table-l3.qzv \
  --m-sample-metadata-file metadata-44.tsv

### Running ANCOM-BC with FDR correction
#### Genus level 
qiime composition ancombc \
--i-table table-l6.qza \
--m-metadata-file metadata-44.tsv \
--p-formula Sex \
--o-differentials table-l6-diff.qza

Hello @Emily_Yu,

I found someone who had a similar issue here. See if the solution in that post resolves the issue.

1 Like

Thanks!

I tried searching for the .condaarc file with no luck. When I run conda info, it says that my "user config file" and "populated config files" have the following path: /Users/emilyyu/.condarc. However, this file does not exist when I am in my "emilyyu" directory.

When I run conda config --show channels, I don't think that there was anything modified (unlike what was seen in this other thread):

channels:
  - defaults

Hello @Emily_Yu,

Because the .condarc file starts with a period it is hidden by default; to see it use ls -a. Or use command-shift-. if you're using finder (I'm assuming you're on Mac).

2 Likes

Oh wow thank you, I didn't know that. That solved everything! Appreciate your help :star2:

1 Like