Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to interpret conda package conflicts?

I am attempting to create a conda environment with 3 packages and a specific python version and get the following output:

$ conda create -n testing_junk -y instrain awscli samtools python=3.8
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
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 ncurses conflicts for:
python=3.8 -> ncurses[version='>=6.1,<6.2.0a0|>=6.2,<7.0a0|>=6.1,<7.0a0']
awscli -> python[version='>=3.8,<3.9.0a0'] -> ncurses[version='5.9.*|5.9|>=6.1,<6.2.0a0|>=6.2,<7.0a0|>=6.1,<7.0a0|>=6.0,<7.0a0|6.0.*']
instrain -> python[version='>=3.4'] -> ncurses[version='5.9.*|5.9|>=6.1,<6.2.0a0|>=6.2,<7.0a0|>=6.1,<7.0a0|>=6.0,<7.0a0|6.0.*']
python=3.8 -> readline[version='>=7.0,<8.0a0'] -> ncurses[version='5.9.*|>=6.0,<7.0a0|6.0.*']
samtools -> ncurses[version='5.9|5.9.*|>=5.9,<5.10.0a0|>=6.1,<6.2.0a0']

Package python conflicts for:
awscli -> 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.5,<3.6.0a0|3.4.*']
python=3.8
instrain -> biopython -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0|3.4.*|>3|>=3.5|<3.0.0|>=3.6']
instrain -> python[version='>=3.4']
awscli -> python_abi=3.8[build=*_cp38] -> python[version='3.7.*|3.8.*']

Package ca-certificates conflicts for:
samtools -> openssl[version='>=1.1.1a,<1.1.2a'] -> ca-certificates
python=3.8 -> openssl[version='>=1.1.1g,<1.1.2a'] -> ca-certificates
awscli -> python[version='>=2.7,<2.8.0a0'] -> ca-certificates

Package setuptools conflicts for:
python=3.8 -> pip -> setuptools
instrain -> matplotlib-base -> setuptools[version='>=40.0']

Package libgcc-ng conflicts for:
samtools -> ncurses[version='>=6.1,<6.2.0a0'] -> libgcc-ng[version='>=7.2.0']
samtools -> libgcc-ng[version='>=4.9|>=7.3.0']

Package pypy3.6 conflicts for:
instrain -> numpy -> pypy3.6[version='7.3.0.*|7.3.1.*|>=7.3.1']
awscli -> python[version='>=3.6,<3.7.0a0'] -> pypy3.6[version='7.3.*|7.3.0.*|7.3.1.*']

Package bzip2 conflicts for:
samtools -> bzip2[version='1.0.*|>=1.0.6,<2.0a0|>=1.0.8,<2.0a0']
instrain -> pysam -> bzip2[version='>=1.0.6,<2.0a0|>=1.0.8,<2.0a0']
awscli -> python[version='>=3.7,<3.8.0a0'] -> bzip2[version='>=1.0.6,<2.0a0|>=1.0.8,<2.0a0']

Package zlib conflicts for:
samtools -> zlib[version='1.2.11.*|>=1.2.11,<1.3.0a0|1.2.8.*|1.2.8']
samtools -> curl[version='>=7.59.0,<8.0a0'] -> zlib[version='1.2.*|1.2.11']

Package samtools conflicts for:
samtools
instrain -> pysam -> samtools[version='1.3|1.3.1.*|1.3.1|1.5.*|1.6.*|1.7|1.7.*|1.9.*|>=1.4.1|>=1.4.1,<1.5|>=1.4,<1.5|>=1.3,<1.4|>=1.3']

Package openssl conflicts for:
samtools -> curl[version='>=7.59.0,<8.0a0'] -> openssl[version='1.0.*|>=1.0.2o,<1.0.3a|>=1.0.2m,<1.0.3a']
samtools -> openssl[version='>=1.0.2p,<1.0.3a|>=1.0.2r,<1.0.3a|>=1.1.1a,<1.1.2a']

Package _libgcc_mutex conflicts for:
samtools -> libgcc-ng[version='>=7.3.0'] -> _libgcc_mutex[version='*|0.1',build='main|conda_forge']
python=3.8 -> libgcc-ng[version='>=7.5.0'] -> _libgcc_mutex[version='*|0.1',build='main|conda_forge']The following specifications were found to be incompatible with your CUDA driver:

  - feature:/linux-64::__cuda==10.2=0
  - feature:|@/linux-64::__cuda==10.2=0

Your installed CUDA driver is: 10.2

I understand that there is something about the packages that conflict with each other, but I'm unable to interpret this output to understand what the problem is.

For example, in looking at the first block of conflicts (related to ncurses), shouldn't version 6.1 satisfy all requirements listed?

Additionally, for the block about package setuptools, I don't see any problem at all?

Any insight into how to interpret these conflicts so that I can attempt to address them would be much appreciated.

like image 846
Matt Olm Avatar asked Jun 09 '20 17:06

Matt Olm


People also ask

Does conda share packages between environments?

With conda, you can create, export, list, remove, and update environments that have different versions of Python and/or packages installed in them. Switching or moving between environments is called activating the environment. You can also share an environment file.


2 Answers

Some Practical Advice

@Quantum7's answer gives a fine literal interpretation of Conda's conflict reporting. However, I wanted to offer a more practical take, which is that this "feature" from Conda is too non-specific to be useful in most non-trivial environments. And sometimes it won't even include the underlying conflict. Don't waste your time with it!

Conda's Conflict Reporting is Often Not Helpful

On the face of it, Conda attempts to report all possible sources of conflict. That is, all sets of paths in the dependency graph that begin from the explicit specifications and end in the same package. This amounts to most of what is reported being innocuous and frankly distracting. For example, the zlib "conflicts":

Package zlib conflicts for:
samtools -> zlib[version='1.2.11.*|>=1.2.11,<1.3.0a0|1.2.8.*|1.2.8']
samtools -> curl[version='>=7.59.0,<8.0a0'] -> zlib[version='1.2.*|1.2.11']

Since samtools depends on zlib both directly and indirectly (mediated through curl), this comes up as two alternate paths that lead to constraints. The problem is that the intersection of the final constraints are not empty, such that there is nothing incompatible here.

Furthermore, there are cases where none of what is reported is in conflict (e.g., this question or this one), which means parsing through the output could be a complete waste of time.

Try Mamba

Instead, if one is actually concerned with resolving conflicts, I find Mamba to be more effective to work with, both in speed and precision.

# install mamba
conda install -n base conda-forge::mamba

# use 'mamba' just like 'conda'
mamba create -n foo instrain awscli samtools python=3.8

Unfortunately, this example simply works now. However, there are other questions where Conda and Mamba unsatisfiability reporting is compared, e.g., this question.

like image 82
merv Avatar answered Oct 24 '22 00:10

merv


The package version specification is described here, but the important parts are:

  • , represents AND and has the highest precedence
  • | represents OR and has second precedence
  • Alpha versions (e.g. '6.2.0a0') are used in upper bounds since they are the first possible release from that version

As an example, consider the first line of the ncurses group:

python=3.8 -> ncurses[version='>=6.1,<6.2.0a0|>=6.2,<7.0a0|>=6.1,<7.0a0']

This indicates that your requested python=3.8 depends on ncurses with the following versions:

  • >=6.1,<6.2.0a0 version 6.1*
  • OR >=6.2,<7.0a0 version 6.2*
  • OR >=6.1,<7.0a0 (redundantly) at least 6.1 but not as high as 7.0

The lists are difficult to read since they include many unnecessary constraints. However, also didn't see any real conflicts with your versions. Not trusting my own ability to check package specifications, I found the conda package that does it directly:

>>> from conda.models import version as cv
>>> cv.VersionSpec(">=6.1,<6.2.0a0|>=6.2,<7.0a0|>=6.1,<7.0a0").match("6.1")
True

Running this on all the conflicts you reported, I was a able to find versions that satisfied all the stated version requirements: https://gist.github.com/sbliven/aab43e1f0bce1f4ac63aaaaa718df0b3

The only part I can't test is the cuda part, but it does look like you have a graphics card that supports CUDA 10.2.

When I started this answer I was preparing an explanation about how SAT solvers like the one used in conda add constraints iteratively and how that could lead to seemingly valid constraints being output as conflicts. However, there should always be some conflict, so I think your issue must lie elsewhere

Since samtools seems to have been removed from conda-forge I'm unable to reproduce the example myself, so I'm left confused about the exact error you're seeing. Hopefully understanding the version strings helps in the future.

Edit: Of course, samtools is from bioconda not conda-forge! The following command worked for me:

conda create -n testing_junk -c bioconda -y instrain awscli samtools python=3.8

It resolved to these package versions (maybe something was fixed since your question posted):

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    asteval-0.9.16             |     pyh5ca1d4c_0          18 KB  conda-forge
    awscli-1.18.221            |   py38h50d1736_0         1.8 MB  conda-forge
    biopython-1.74             |   py38h0b31af3_0         2.5 MB  conda-forge
    blas-2.14                  |         openblas          10 KB  conda-forge
    boost-1.70.0               |   py38hbf1eeb5_1         347 KB  conda-forge
    boost-cpp-1.70.0           |       hef959ae_3        18.9 MB  conda-forge
    botocore-1.19.61           |     pyhd8ed1ab_0         4.5 MB  conda-forge
    brotlipy-0.7.0             |py38h5406a74_1001         357 KB  conda-forge
    c-ares-1.11.0              |                0          73 KB  bioconda
    capnproto-0.6.1            |       h0ceac7d_2         2.4 MB  conda-forge
    cffi-1.14.4                |   py38h979bc6b_1         219 KB  conda-forge
    colorama-0.4.3             |             py_0          17 KB  conda-forge
    cryptography-3.3.1         |   py38h6b4ec92_1         614 KB  conda-forge
    docutils-0.15.2            |   py38h50d1736_1         739 KB  conda-forge
    drep-3.0.0                 |             py_2          59 KB  bioconda
    fastani-1.32               |       he69ab0f_0         151 KB  bioconda
    future-0.18.2              |   py38h50d1736_3         715 KB  conda-forge
    hdf5-1.10.6                |nompi_h34ad4e8_1111         3.0 MB  conda-forge
    htslib-1.11                |       h422799e_1         1.5 MB  bioconda
    idna-3.1                   |     pyhd3deb0d_0          52 KB  conda-forge
    instrain-1.4.0             |             py_0         380 KB  bioconda
    jmespath-0.10.0            |     pyh9f0ad1d_0          21 KB  conda-forge
    joblib-1.0.0               |     pyhd8ed1ab_0         206 KB  conda-forge
    kiwisolver-1.3.1           |   py38hd9c93a9_1          57 KB  conda-forge
    libblas-3.8.0              |      14_openblas          10 KB  conda-forge
    libcblas-3.8.0             |      14_openblas          10 KB  conda-forge
    libdeflate-1.6             |       h0b31af3_0          61 KB  conda-forge
    liblapack-3.8.0            |      14_openblas          10 KB  conda-forge
    liblapacke-3.8.0           |      14_openblas          10 KB  conda-forge
    libnghttp2-1.41.0          |       h8a08a2b_1         736 KB  conda-forge
    libopenblas-0.3.7          |       h3d69b6c_4         8.2 MB  conda-forge
    llvm-openmp-8.0.1          |       h770b8ee_0         253 KB  conda-forge
    llvmlite-0.34.0            |   py38h3707e27_2         247 KB  conda-forge
    lmfit-1.0.1                |             py_1          69 KB  conda-forge
    mash-2.2.2                 |       h194473e_2         449 KB  bioconda
    matplotlib-base-3.3.4      |   py38hb24f337_0         6.8 MB  conda-forge
    mummer4-4.0.0rc1           |  pl526h4a8c4bd_0         699 KB  bioconda
    numba-0.51.2               |   py38h6be0db6_0         3.5 MB  conda-forge
    openmp-8.0.1               |                0           8 KB  conda-forge
    pandas-1.2.1               |   py38he9f00de_0        10.6 MB  conda-forge
    pillow-8.1.0               |   py38hc1d52f7_1         646 KB  conda-forge
    pluggy-0.13.1              |   py38h50d1736_4          29 KB  conda-forge
    prodigal-2.6.3             |       h01d97ff_2         397 KB  bioconda
    psutil-5.8.0               |   py38h5406a74_1         350 KB  conda-forge
    pyasn1-0.4.8               |             py_0          53 KB  conda-forge
    pysam-0.16.0.1             |   py38hb3e8b06_1         2.1 MB  bioconda
    pysocks-1.7.1              |   py38h50d1736_3          27 KB  conda-forge
    pytest-6.2.2               |   py38h50d1736_0         432 KB  conda-forge
    pyyaml-5.3.1               |   py38h5406a74_2         173 KB  conda-forge
    rsa-4.4.1                  |     pyh9f0ad1d_0          27 KB  conda-forge
    s3transfer-0.3.4           |     pyhd8ed1ab_0          51 KB  conda-forge
    samtools-1.11              |       h725deca_0         381 KB  bioconda
    scikit-learn-0.22.1        |   py38hebd9d1a_0         4.7 MB
    scipy-1.5.3                |   py38h352ea5d_0        19.1 MB  conda-forge
    seaborn-0.11.1             |       hd8ed1ab_1           4 KB  conda-forge
    seaborn-base-0.11.1        |     pyhd8ed1ab_1         217 KB  conda-forge
    statsmodels-0.12.1         |   py38hc7193ba_2        10.5 MB  conda-forge
    tornado-6.1                |   py38h5406a74_1         643 KB  conda-forge
    uncertainties-3.1.5        |     pyhd8ed1ab_0          75 KB  conda-forge
    ------------------------------------------------------------
                                           Total:       110.1 MB
like image 38
Quantum7 Avatar answered Oct 24 '22 02:10

Quantum7