'conda install: Package zlib conflicts for zlib[version='>=1.2.11,<1.3.0a0']

I am trying to install a given version of perl-bioperl with conda:

$ conda install -c conda-forge perl

$ which perl
/home/hakon/miniconda3/bin/perl

$ perl --version
This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux-thread-multi

$ conda install -c bioconda perl-bioperl=1.7.8
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 each other:

Output in format: Requested package -> Available versions

Package zlib conflicts for:
perl-bioperl=1.7.8 -> perl-bio-samtools -> zlib[version='>=1.2.11,<1.3.0a0']
python=3.9 -> zlib[version='>=1.2.11,<1.3.0a0']

Package libgcc-ng conflicts for:
python=3.9 -> zlib[version='>=1.2.11,<1.3.0a0'] -> libgcc-ng[version='>=7.2.0']
python=3.9 -> libgcc-ng[version='>=7.3.0|>=7.5.0']The following specifications were found to be incompatible with your system:

  - feature:/linux-64::__glibc==2.31=0
  - feature:|@/linux-64::__glibc==2.31=0

Your installed version is: 2.31

$ conda list | grep zlib
zlib                      1.2.11               h7f8727e_4  

$ conda list | grep libgcc-ng
libgcc-ng    9.3.0               h5101ec6_17  

This is confusing to me. For example this message:

Package zlib conflicts for:
perl-bioperl=1.7.8 -> perl-bio-samtools -> zlib[version='>=1.2.11,<1.3.0a0']
python=3.9 -> zlib[version='>=1.2.11,<1.3.0a0']

why is this a conflict when my current version of zlib is:

$ conda list | grep zlib
zlib                      1.2.11               h7f8727e_4  

And what could I do to resolve this conflict (if it is a conflict)?



Solution 1:[1]

A workaround is to create a new environment with conda-forge as default channel (see also this answer) instead of installing into the base environment:

$ conda create --name perl
$ conda activate perl
$ conda config --add channels conda-forge
$ conda config --set channel_priority strict
$ conda install perl
$ conda install -c bioconda perl-bioperl=1.7.8

Solution 2:[2]

All Bioconda packages are generated with very specific channel priorities, namely conda-forge > bioconda > defaults and if one doesn't follow this, correct solving and dynamic library references cannot be guaranteed. So, a proper ad hoc installation command would be

conda install -c conda-forge -c bioconda -c defaults perl-bioperl=1.7.8

Encouraged Workflow

However, I would strongly encourage bioinformaticians (and other practitioners that value reproducible workflows) to not use ad hoc commands. Instead, adopt the practice of only working from YAML files to define software environments:

bioperl_1_7_8.yaml

name: bioperl_1_7_8
channels:
  - conda-forge
  - bioconda
  - defaults
dependencies:
  - perl
  - bioperl=1.7.8

Use this with conda env create -f bioperl_1_7_8.yaml.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Håkon Hægland
Solution 2 merv