rcondabioconductormamba

Cannot install R Bioconductor packages via Conda


I wanted to start using Conda environments on my new computer (macOS), primarily for bioinformatic analysis. However, I cannot bring it to download Bioconda bioconductor packages.

I tried several approaches right now, but could not accomplish a succesful installation.

Installation

I basically followed the instructions on this website

Starting by downlaoding mambaforge from the github via this command:

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge-$(uname)-$(uname -m).sh

Setup

I then created a first R environment, similar to outlined here

So I created an environment via:

mamba create -n R-4.3.0 -c conda-forge r-base r-essentials

And so far, everything works fine: I can activate the environment and use R.

Problem

Now the problem arises when I try to also install a bioconductor, bioconda R-package, such as DESeq2, edger, or minfi (those are the ones I tested).

It always ends in somehow refusing to install,find the package

Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - bioconductor-deseq2

Current channels:

  - https://conda.anaconda.org/bioconda/osx-arm64
  - https://conda.anaconda.org/bioconda/noarch
  - https://conda.anaconda.org/conda-forge/osx-arm64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://conda.anaconda.org/r/osx-arm64
  - https://conda.anaconda.org/r/noarch
  - https://repo.anaconda.com/pkgs/main/osx-arm64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-arm64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

I initially tried to install it from a YAML-file, which looks like this

name: methylation
channels:
  - bioconda
  - conda-forge
  - default
dependencies:
  - conda-forge::r-base
  - conda-forge::r-essentials
  - bioconductor-deseq2

or with conda install -c bioconda bioconductor-deseq2

I have also tried to do the same with micromamba, installed via homebrew and set my .condarc and/or .mambarc file as described on bioconda, but I make no progress.


Solution

  • A few issues:

    Taking that all into consideration, here is a better YAML:

    methylation.yaml

    name: methylation
    channels:
      - conda-forge
      - bioconda
      - nodefaults  ## block user/system channels
    dependencies:
      - r-base=4.2  ## always specify the R version (faster solve; more stable)
      - r-essentials
      - bioconductor-deseq2
    

    To install this, we need to override your default platform osx-arm64 and replace it with osx-64:

    CONDA_SUBDIR=osx-64 mamba env create -n methylation -f methylation.yaml
    
    ## set the subdir for the environment
    mamba activate methylation
    conda config --env --set subdir osx-64
    

    Note: Always activate this environment before installing packages in it - otherwise it will fall back to using osx-arm64.