You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法通过Conda安装R语言Bioconductor包问题求助

macOS ARM架构下Conda安装Bioconductor包失败问题及解决方法

问题详情

在新的macOS(ARM架构)电脑上搭建生物信息分析Conda环境,已通过以下命令完成Mambaforge安装:

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

随后创建R-4.3.0环境:

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

环境可正常激活使用R,但安装Bioconductor的DESeq2、edgeR、minfi等包时,持续触发PackagesNotFoundError,提示当前频道无对应包。尝试过YAML文件配置、conda install -c bioconda bioconductor-deseq2命令,以及换用Homebrew安装的micromamba并调整.condarc/.mambarc,均未解决问题。

报错信息如下:

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.

使用的YAML文件内容:

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

核心原因

Bioconda仓库中部分Bioconductor包暂未提供osx-arm64架构的预编译包,这是导致安装失败的关键因素。

解决方法

方法一:R环境内直接安装(推荐)

激活目标R环境后,进入R控制台,使用Bioconductor官方工具安装:

# 安装BiocManager(首次使用需执行)
install.packages("BiocManager")
# 批量安装目标包
BiocManager::install(c("DESeq2", "edgeR", "minfi"))

该方式会直接从Bioconductor源拉取源码,在本地编译适配ARM架构的版本,兼容性更好。

方法二:创建x86_64架构的Conda环境

通过Rosetta 2模拟x86_64架构,使用对应版本的Mambaforge:

  1. 切换终端至x86_64模式:
arch -x86_64 zsh
  1. 下载并安装x86_64版本的Mambaforge:
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-MacOSX-x86_64.sh"
bash Mambaforge-MacOSX-x86_64.sh
  1. 创建新环境并安装所需包:
mamba create -n R-4.3.0-x86 -c conda-forge -c bioconda r-base=4.3.0 r-essentials bioconductor-deseq2 bioconductor-edger bioconductor-minfi

方法三:配置Conda允许源码编译

修改.condarc或.mambarc文件,添加跨编译支持:

channels:
  - bioconda
  - conda-forge
  - defaults
subdir: osx-arm64
conda_build:
  cross_compile: True

保存后尝试重新安装包:

mamba install -n R-4.3.0 -c bioconda bioconductor-deseq2

注意:此方法需要提前安装Xcode Command Line Tools(执行xcode-select --install完成安装),且源码编译耗时较长。

内容的提问来源于stack exchange,提问作者Lukas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 22:39:56