使用 conda 安装软件包时发现冲突

Found conflict while installing packages with conda

我试图在 ubuntu 20.04 的 conda 环境中安装 trim-galore 并且出现了这条消息,因为这是我第一次使用它,我不知道如何解决这个问题:

    Collecting package metadata (current_repodata.json): done
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.
    Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
    Collecting package metadata (repodata.json): done
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.
    Solving environment: / 
    Found conflicts! Looking for incompatible packages.
    This can take several minutes.  Press CTRL-C to abort.
    failed                                                                    
    
    UnsatisfiableError: The following specifications were found
    to be incompatible with the existing python installation in your environment:
    
    Specifications:
    
      - trim-galore -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0|>=3.5,<3.6.0a0|3.4.*']
    
    Your python: python=3.10
    
    If python is on the left-most side of the chain, that's the version you've asked for.
    When python appears to the right, that indicates that the thing on the left is somehow
    not available for the python version you are constrained to. Note that conda will not
    change your python version to a different minor version unless you explicitly specify
    that.
    
    The following specifications were found to be incompatible with your system:
    
      - feature:/linux-64::__glibc==2.31=0
      - python=3.10 -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
    
    Your installed version is: 2.31

命令我 运行 是 conda install -c bioconda trim-galore 并且我 运行 在激活我的环境后。

conda的版本是4.11.0

您之前指定过

python=3.10

对于这个环境。最有可能在创建它时。这为此 python 版本创建了一个 pin。现在,当您尝试安装 trim-galore 时,问题是它依赖于 cutadapt,没有支持 python 3.10 的版本存在:

conda search -c bioconda --info cutadapt=3.7
Loading channels: done
cutadapt 3.7 py37h8902056_0
---------------------------
file name   : cutadapt-3.7-py37h8902056_0.tar.bz2
name        : cutadapt
version     : 3.7
build       : py37h8902056_0
build number: 0
size        : 197 KB
license     : MIT
subdir      : linux-64
url         : https://conda.anaconda.org/bioconda/linux-64/cutadapt-3.7-py37h8902056_0.tar.bz2
md5         : 372ffd8db0a584443d817f2f91b95cdf
timestamp   : 2022-02-23 18:06:03 UTC
dependencies:
  - dnaio >=0.7.0
  - libgcc-ng >=10.3.0
  - python >=3.7,<3.8.0a0
  - python_abi 3.7.* *_cp37m
  - xopen >=1.2.0


cutadapt 3.7 py37h8902056_1
---------------------------
file name   : cutadapt-3.7-py37h8902056_1.tar.bz2
name        : cutadapt
version     : 3.7
build       : py37h8902056_1
build number: 1
size        : 197 KB
license     : MIT
subdir      : linux-64
url         : https://conda.anaconda.org/bioconda/linux-64/cutadapt-3.7-py37h8902056_1.tar.bz2
md5         : bb181439876574c985916d94dce49979
timestamp   : 2022-02-25 22:48:07 UTC
dependencies:
  - dnaio >=0.7.0
  - libgcc-ng >=10.3.0
  - python >=3.7,<3.8.0a0
  - python_abi 3.7.* *_cp37m
  - xopen >=1.2.0


cutadapt 3.7 py38hbff2b2d_0
---------------------------
file name   : cutadapt-3.7-py38hbff2b2d_0.tar.bz2
name        : cutadapt
version     : 3.7
build       : py38hbff2b2d_0
build number: 0
size        : 201 KB
license     : MIT
subdir      : linux-64
url         : https://conda.anaconda.org/bioconda/linux-64/cutadapt-3.7-py38hbff2b2d_0.tar.bz2
md5         : e38630777b8d17687134aa015ca88385
timestamp   : 2022-02-23 18:01:48 UTC
dependencies:
  - dnaio >=0.7.0
  - libgcc-ng >=10.3.0
  - python >=3.8,<3.9.0a0
  - python_abi 3.8.* *_cp38
  - xopen >=1.2.0


cutadapt 3.7 py38hbff2b2d_1
---------------------------
file name   : cutadapt-3.7-py38hbff2b2d_1.tar.bz2
name        : cutadapt
version     : 3.7
build       : py38hbff2b2d_1
build number: 1
size        : 201 KB
license     : MIT
subdir      : linux-64
url         : https://conda.anaconda.org/bioconda/linux-64/cutadapt-3.7-py38hbff2b2d_1.tar.bz2
md5         : c8101ce2f3ffcbca9b3bb2df93a9730f
timestamp   : 2022-02-25 22:44:37 UTC
dependencies:
  - dnaio >=0.7.0
  - libgcc-ng >=10.3.0
  - python >=3.8,<3.9.0a0
  - python_abi 3.8.* *_cp38
  - xopen >=1.2.0


cutadapt 3.7 py39hbf8eff0_0
---------------------------
file name   : cutadapt-3.7-py39hbf8eff0_0.tar.bz2
name        : cutadapt
version     : 3.7
build       : py39hbf8eff0_0
build number: 0
size        : 200 KB
license     : MIT
subdir      : linux-64
url         : https://conda.anaconda.org/bioconda/linux-64/cutadapt-3.7-py39hbf8eff0_0.tar.bz2
md5         : 5aaca511ac0bbc132a07a4ee9b1a7a64
timestamp   : 2022-02-23 17:57:41 UTC
dependencies:
  - dnaio >=0.7.0
  - libgcc-ng >=10.3.0
  - python >=3.9,<3.10.0a0
  - python_abi 3.9.* *_cp39
  - xopen >=1.2.0


cutadapt 3.7 py39hbf8eff0_1
---------------------------
file name   : cutadapt-3.7-py39hbf8eff0_1.tar.bz2
name        : cutadapt
version     : 3.7
build       : py39hbf8eff0_1
build number: 1
size        : 200 KB
license     : MIT
subdir      : linux-64
url         : https://conda.anaconda.org/bioconda/linux-64/cutadapt-3.7-py39hbf8eff0_1.tar.bz2
md5         : cde0658556fc58ac82a54986971020ad
timestamp   : 2022-02-25 22:41:16 UTC
dependencies:
  - dnaio >=0.7.0
  - libgcc-ng >=10.3.0
  - python >=3.9,<3.10.0a0
  - python_abi 3.9.* *_cp39
  - xopen >=1.2.0

您也可以在错误消息中告知 conda 发现兼容的 python 版本列表

python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0|>=3.9,<3.10.0a0|>=3.5,<3.6.0a0|3.4.*']

使用 pin python=3.10 后,conda 无法降级您的 python 版本,但有两种简单的解决方法:

  • python 指定为安装目标:conda install -c conda-forge -c bioconda trim-galore python 以允许 conda 确定要将环境更改为
  • 的 python 版本
  • 创建一个新环境,从一开始就指定您需要什么:conda create -n tg -c conda-forge -c bioconda python trim-galore