Search code examples
pythonopencvscikit-learnminiconda

Using conda to install opencv


I have miniconda installed.

Using conda, I tried to install opencv3.3.

Then other libraries are also removed or upgraded.

I have problem with other libraries for my application.

Why conda doesn't install opencv only and trying to make changes to others.

The issue is shown below.

When I install opencv, the scikit-learn will be removed. How to make so that only opencv is installed and others are not affected.

(openface) nyan@nyan-Inspiron-7537:~/openface$ conda install opencv==3.3
Solving environment: done

## Package Plan ##

  environment location: /home/nyan/miniconda3/envs/openface

  added / updated specs: 
    - opencv==3.3


The following NEW packages will be INSTALLED:

    opencv:       3.3.0-py27_blas_openblas_204       conda-forge [blas_openblas]

The following packages will be REMOVED:

    scikit-learn: 0.17.1-np111py27_blas_openblas_202 conda-forge [blas_openblas]

The following packages will be UPDATED:

    boost:        1.61.0-py27_1                      conda-forge --> 1.68.0-py27h3e44d54_1                conda-forge
    boost-cpp:    1.63.0-1                           conda-forge --> 1.68.0-h3a22d5f_0                    conda-forge
    cairo:        1.14.6-0                           conda-forge --> 1.14.10-0                            conda-forge
    dlib:         19.0-np111py27_blas_openblas_200   conda-forge [blas_openblas] --> 19.10-py27_blas_openblas_200         conda-forge [blas_openblas]
    fontconfig:   2.11.1-6                           conda-forge --> 2.12.6-0                             conda-forge
    freetype:     2.6.3-1                            conda-forge --> 2.8.1-hfa320df_1                     conda-forge
    harfbuzz:     1.0.6-1                            conda-forge --> 1.7.6-0                              conda-forge
    icu:          56.1-4                             conda-forge --> 58.2-hfc679d8_0                      conda-forge
    libxml2:      2.9.4-3                            conda-forge --> 2.9.8-h422b904_5                     conda-forge
    matplotlib:   2.0.0-np111py27_1                  conda-forge --> 2.2.2-py27_1                         conda-forge
    openblas:     0.2.18-6                           conda-forge --> 0.2.20-8                             conda-forge
    pango:        1.40.1-0                           conda-forge --> 1.40.14-0                            conda-forge
    pillow:       4.0.0-py27_1                       conda-forge --> 5.2.0-py27h2dc6135_1                 conda-forge
    pyqt:         4.11.4-py27_3                      conda-forge --> 5.6.0-py27h8210e8a_7                 conda-forge
    python:       2.7.11-0                                       --> 2.7.14-h1571d57_29                              
    qt:           4.8.7-3                            conda-forge --> 5.6.2-7                              conda-forge
    readline:     6.2-2                                          --> 7.0-haf1bffa_1                       conda-forge
    scipy:        0.18.1-np111py27_blas_openblas_200 conda-forge [blas_openblas] --> 1.1.0-py27_blas_openblash7943236_201 conda-forge [blas_openblas]
    sqlite:       3.13.0-1                           conda-forge --> 3.20.1-0                             conda-forge
    tk:           8.5.19-2                           conda-forge --> 8.6.9-ha92aebf_0                     conda-forge

Proceed ([y]/n)? n


CondaSystemExit: Exiting.

Solution

  • When you install a packe with conda then it tries to install and update the dependencies of the required package. I am not sure why it wants to remove the scikit but I think it's related to an update cascade. For example opencv has a dependency which requires an update from an another package but and this package is the dependency of scikit but with this update conda thinks scikit will work no more and that can be a reason for the removal of scikit. Possible solution can be to use the --no-update-deps option with the install command:

    conda install opencv==3.3 --no-update-deps
    

    If your conda version doesn't have this option the check the available options with

    conda install --help
    

    and select the correct one which disables the dependency updates.