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

指定版本Conda环境在Snakemake中遇优先级及samtools依赖问题求助

解决Snakemake Conda环境配置的两类问题

问题1:版本1的仓库优先级冲突

版本1配置

name: pipeline_env
channels:
  - defaults
dependencies:
  - bioconda::bcftools=1.8
  - bioconda::bedtools=2.27.1
  - bioconda::biopython=1.71
  - bioconda::bwa=0.7.15
  - bioconda::fastqc=0.11.9
  - bioconda::freebayes=1.0.2
  - bioconda::gatk=3.7
  - bioconda::htslib=1.6
  - bioconda::lofreq=2.1.3.1
  - conda-forge::numpy=1.16.6
  - conda-forge::perl=5.34.0
  - bioconda::picard=2.23.3
  - conda-forge::pip=19.3.1
  - python=3.6.10
  - bioconda::samtools=1.7
  - bioconda::vcftools=0.1.16
  - conda-forge::zlib=1.2.11

报错信息

Building DAG of jobs...
Creating conda environment workflow/envs/main.yml...
Downloading and installing remote packages.
CreateCondaEnvironmentException:
Could not create conda environment from /net/smith/vol1/home/user/yevo_pipeline/workflow/envs/main.yml:
Command:
mamba env create --quiet --file "/net/smith/vol1/home/user/.snakemake/conda/dca10f2a3bdb2327c0d6ee1cefb17e1c_.yaml" --prefix "/net/smith/vol1/home/user/.snakemake/conda/dca10f2a3bdb2327c0d6ee1cefb17e1c_"
Output:
Retrieving notices: ...working... done
error    libmamba Selected channel specific (or force-reinstall) job, but package is not available from channel. Solve job will fail.
error    libmamba Selected channel specific (or force-reinstall) job, but package is not available from channel. Solve job will fail.
Encountered problems while solving:
  - package htslib-1.6-0 is excluded by strict repo priority
  - package pip-19.3.1-py38_0 is excluded by strict repo priority
  - package zlib-1.2.11-h516909a_1010 is excluded by strict repo priority
  - package numpy-1.16.6-py38h18fd61f_0 is excluded by strict repo priority

原因

defaults通道优先级最高,但配置中强制指定从bioconda/conda-forge拉取部分包,在strict优先级模式下,高优先级通道无对应包时会直接报错,不会自动降级到低优先级通道查找。


问题2:版本2的samtools依赖库缺失

版本2配置

name: pipeline_env
channels:
  - conda-forge
  - bioconda
  - defaults
dependencies:
  - bioconda::bcftools=1.8
  - bioconda::bedtools=2.27.1
  - bioconda::biopython=1.71
  - bioconda::bwa=0.7.15
  - bioconda::fastqc=0.11.9
  - bioconda::freebayes=1.0.2
  - bioconda::gatk=3.7
  - htslib=1.6
  - bioconda::lofreq=2.1.3.1
  - numpy=1.16.6
  - conda-forge::perl=5.34.0
  - bioconda::picard=2.23.3
  - pip=19.3.1
  - python=3.6.10
  - bioconda::samtools=1.7
  - bioconda::vcftools=0.1.16
  - zlib=1.2.11

报错信息

samtools: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory

原因

samtools 1.7依赖旧版本openssl(提供libcrypto.so.1.0.0),但conda-forge通道的openssl已更新到更高版本,导致依赖缺失。


解决方案

修正后的Conda YAML配置

name: pipeline_env
channels:
  - bioconda
  - conda-forge
  - defaults
dependencies:
  - bcftools=1.8
  - bedtools=2.27.1
  - biopython=1.71
  - bwa=0.7.15
  - fastqc=0.11.9
  - freebayes=1.0.2
  - gatk=3.7
  - htslib=1.6
  - lofreq=2.1.3.1
  - numpy=1.16.6
  - perl=5.34.0
  - picard=2.23.3
  - pip=19.3.1
  - python=3.6.10
  - samtools=1.7
  - vcftools=0.1.16
  - zlib=1.2.11
  # 显式添加samtools依赖的旧版本openssl
  - openssl=1.0.2u

关键调整说明

  1. 优化通道顺序:将bioconda放在最前面,生物信息学工具优先从专业通道获取,避免通用通道包干扰;conda-forge次之,最后是defaults。
  2. 移除强制通道前缀:删除bioconda::、conda-forge::这类前缀,让mamba/conda自动从优先级最高的可用通道获取对应版本包,解决优先级冲突问题。
  3. 补全缺失依赖:显式添加openssl=1.0.2u,提供samtools 1.7所需的libcrypto.so.1.0.0动态库。

验证步骤

  1. 删除旧环境:conda remove -n pipeline_env --all
  2. 创建新环境:conda env create -f workflow/envs/main.yml
  3. 激活环境:conda activate pipeline_env
  4. 测试samtools:samtools --version,确认无报错。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.12 21:47:39