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

Linux/Windows下Conda通过YAML创建环境失败求助

Conda环境创建失败问题排查与解决

Linux系统报错情况

执行命令(注意原命令存在拼写错误,正确命令见下方修正版):

create env create -f env.yaml  # 错误命令,正确应为:conda env create -f env.yaml

报错信息:

Collecting package metadata (repodata.json): done
Solving environment: - Killed

补充信息:系统剩余空间近100GB,Conda版本为23.1.0,该YAML文件其他用户可正常使用。

Windows 10系统报错情况

执行命令:

conda env create -f env.yaml

报错信息:

Collecting package metadata (repodata.json): done Solving environment: failed

ResolvePackageNotFound:
  - hisat2=2.1.0
  - multiqc=1.5
  - salmon=0.14.1
  - graphviz=2.40.1
  - trim-galore=0.6.2
  - samtools=1.9
  - bioconductor-edger=3.26.0
  - htseq=0.11.2
  - subread=1.6.4
  - bioconductor-deseq2=1.22.1

单独安装包失败示例(以hisat2为例):
执行conda install -c bioconda hisat2后,提示PackagesNotFoundError,当前渠道无对应包。

提供的env.yaml文件内容

name: rasflow 
channels:
  - conda-forge
  - bioconda
  - r
  - defaults
dependencies:
  - snakemake=5.3.0
  - graphviz=2.40.1
# command tool installs
  - R=3.5.1
  - python=3.6.7
# r channel installs
  - r-yaml=2.2.0
  - r-statmod=1.4.30
  - r-gplots=3.0.1
# conda-forge channel installs
  - r-heatmap.plus=1.3
  - r-readr=1.3.1
  - r-hash=3.0.1
# bioconda channel installs
  - fastqc=0.11.8
  - trim-galore=0.6.2
  - multiqc=1.5
  - salmon=0.14.1
  - hisat2=2.1.0
  - samtools=1.9
  - subread=1.6.4  # featureCounts included
  - htseq=0.11.2  # htseq-count included
  - bioconductor-edger=3.26.0
  - bioconductor-deseq2=1.22.1
  - qualimap=2.2.2a
  - bioconductor-mygene=1.18.0
  - bioconductor-tximport=1.12.1
  - bioconductor-enhancedvolcano=1.2.0
  - bioconductor-biomart=2.38.0

问题原因分析

  1. Linux系统报错(Solving environment: Killed)

    • 核心原因是Conda求解环境时内存不足。Conda 23.x版本处理旧版本包(如Python 3.6、R 3.5)的依赖关系时,计算量陡增,容易触发系统OOM(内存不足)杀死进程,与磁盘空间无关。
    • 旧版本包的依赖链复杂,新版本Conda的求解器对这类场景的内存优化不足。
  2. Windows系统报错(ResolvePackageNotFound)

    • 指定的包版本过于老旧,部分生物信息学工具(如hisat2=2.1.0、samtools=1.9)的Windows编译包已从Conda渠道中移除。
    • Bioconda对Windows系统的支持有限,多数旧版生物信息学工具仅提供Linux/macOS版本。

解决方案

针对Linux系统

  1. 修正命令拼写:执行正确的环境创建命令:
    conda env create -f env.yaml
    
  2. 启用低内存求解模式:降低Conda求解时的内存占用:
    conda config --set solver.low_memory true
    conda env create -f env.yaml
    
  3. 降级Conda版本:旧版本Conda(如4.x系列)对旧包的依赖求解效率更高,内存占用更低:
    conda install conda=4.12.0
    conda env create -f env.yaml
    
  4. 释放系统内存:关闭其他占用内存的进程,或临时增加swap空间。

针对Windows系统

  1. 使用WSL2:在Windows上安装WSL2,切换到Linux环境执行环境创建,复用Linux系统的解决方案。
  2. 更新YAML中的包版本:将老旧包替换为支持Windows的新版本,同时同步更新R、Python版本(Bioconductor版本与R版本绑定),示例调整如下:
    name: rasflow 
    channels:
      - conda-forge
      - bioconda
      - r
      - defaults
    dependencies:
      - snakemake=7.32.4
      - graphviz=9.0.0
      - R=4.2.3
      - python=3.9.18
      - r-yaml=2.3.7
      - r-statmod=1.5.0
      - r-gplots=3.1.3
      - r-heatmap.plus=1.3.1
      - r-readr=2.1.4
      - r-hash=2.2.6.3
      - fastqc=0.11.9
      - trim-galore=0.6.10
      - multiqc=1.15
      - salmon=1.10.1
      - hisat2=2.2.1
      - samtools=1.17
      - subread=2.0.6
      - htseq=2.0.3
      - bioconductor-edger=3.40.2
      - bioconductor-deseq2=1.38.3
      - qualimap=2.2.2d
      - bioconductor-mygene=1.24.0
      - bioconductor-tximport=1.26.0
      - bioconductor-enhancedvolcano=1.16.0
      - bioconductor-biomart=2.54.0
    
    注意:版本更新后需验证RASflow流程的兼容性。

通用建议

  • 创建环境前先清理并更新Conda索引:
    conda clean --all
    conda update conda
    
  • 对比能正常使用该YAML的用户的Conda版本、渠道配置,同步相同设置(可通过conda config --show导出配置)。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.27 12:53:23